Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Problem in persist due to rollback

You may wish to try EclipseLink and see if you get the same error.  It could
be a Hibernate issue.



akirti wrote:
> 
> Hello All,
> 
> I messed up with saving data in a table which have 4 colums with FK. I'm
> wokring with JPA,Spring and hibernate as a vendor Adaper for persistence
> provider.
> 
> My Problem is my trasaction roll back with batchSaveUpdate error...
> [b]Hibernate
> version:hibernate-annotations-3.4.0.GA,hibernate-distribution-3.3.1.GA-dist,
> hibernate-entitymanager-3.4.0.GA,spring2.5,ejb3 [/b] 
> 
> [b]Mapping documents:[/b]
> [code]
> package com.speduler.model;
> 
> import java.sql.Timestamp;
> import java.util.HashSet;
> import java.util.Set;
> import javax.persistence.CascadeType;
> import javax.persistence.Column;
> import javax.persistence.Entity;
> import javax.persistence.FetchType;
> import javax.persistence.GeneratedValue;
> import javax.persistence.GenerationType;
> import javax.persistence.Id;
> import javax.persistence.JoinColumn;
> import javax.persistence.JoinColumns;
> import javax.persistence.ManyToOne;
> import javax.persistence.OneToMany;
> import javax.persistence.Table;
> import javax.persistence.Temporal;
> import javax.persistence.TemporalType;
> import javax.persistence.UniqueConstraint;
> 
> import org.hibernate.annotations.Cascade;
> import org.hibernate.repackage.cglib.core.GeneratorStrategy;
> 
> 
> @Entity
> @Table(name = "SERVICEPROVIDER", schema = "S2LLC", uniqueConstraints =
> @UniqueConstraint(columnNames = "SERVICEPORVIDERID"))
> @org.hibernate.annotations.Entity(dynamicInsert=true, dynamicUpdate=true)
> public class Serviceprovider implements java.io.Serializable {
> 
> 	// Fields
> 
> 	private Long internalspid;
> 	private Timezonemaster timezonemaster;
> 	private Majorcategorymaster majorcategorymaster;
> 	private Serviceplanmaster serviceplanmaster;
> 	private Statemaster statemaster;
> 	private Countrymaster countrymaster;
> 	private String serviceporviderid;
> 	private String businessname;
> 	private String website;
> 	private String videolink;
> 	private String describebusiness;
> 	private String describefacility;
> 	private String registerphone;
> 	private String registeremail;
> 	private String paymenttype;
> 	private String languagesspeaks;
> 	private String picturemain;
> 	private String picturelink2;
> 	private String picturelink3;
> 	private String picturelink4;
> 	private String picturelink5;
> 	private Timestamp dateupdated;
> 	private String userupdated;
> 	private String ownerlastname;
> 	private String ownerfirstname;
> 	private Timestamp dateregistered;
> 	private Byte numberoflocations;
> 	private Byte numberofstaffs;
> 	private String status;
> 	private Double overalluserrating;
> 	private String encryptedpassword;
> 	private String secretquestion;
> 	private String secretanswer;
> 	private Set<Providerstaffs> providerstaffses = new
> HashSet<Providerstaffs>(
> 			0);
> 	private Set<Providerinsurance> providerinsurances = new
> HashSet<Providerinsurance>(
> 			0);
> 	private Set<Providersettings> providersettingses = new
> HashSet<Providersettings>(
> 			0);
> 	private Set<Providerlocations> providerlocationses = new
> HashSet<Providerlocations>(
> 			0);
> 
> 	// Constructors
> 
> 	/** default constructor */
> 	public Serviceprovider() {
> 	}
> 
> 	/** minimal constructor */
> 	public Serviceprovider(Long internalspid, Timezonemaster timezonemaster,
> 			Majorcategorymaster majorcategorymaster,
> 			Serviceplanmaster serviceplanmaster, Statemaster statemaster,
> 			Countrymaster countrymaster, String serviceporviderid,
> 			String businessname, String describebusiness, String registerphone,
> 			String registeremail, String languagesspeaks) {
> 		this.internalspid = internalspid;
> 		this.timezonemaster = timezonemaster;
> 		this.majorcategorymaster = majorcategorymaster;
> 		this.serviceplanmaster = serviceplanmaster;
> 		this.statemaster = statemaster;
> 		this.countrymaster = countrymaster;
> 		this.serviceporviderid = serviceporviderid;
> 		this.businessname = businessname;
> 		this.describebusiness = describebusiness;
> 		this.registerphone = registerphone;
> 		this.registeremail = registeremail;
> 		this.languagesspeaks = languagesspeaks;
> 	}
> 
> 	/** full constructor */
> 	public Serviceprovider(Long internalspid, Timezonemaster timezonemaster,
> 			Majorcategorymaster majorcategorymaster,
> 			Serviceplanmaster serviceplanmaster, Statemaster statemaster,
> 			Countrymaster countrymaster, String serviceporviderid,
> 			String businessname, String website, String videolink,
> 			String describebusiness, String describefacility,
> 			String registerphone, String registeremail, String paymenttype,
> 			String languagesspeaks, String picturemain, String picturelink2,
> 			String picturelink3, String picturelink4, String picturelink5,
> 			Timestamp dateupdated, String userupdated, String ownerlastname,
> 			String ownerfirstname, Timestamp dateregistered,
> 			Byte numberoflocations, Byte numberofstaffs, String status,
> 			Double overalluserrating, String encryptedpassword,
> 			String secretquestion, String secretanswer,
> 			Set<Providerstaffs> providerstaffses,
> 			Set<Providerinsurance> providerinsurances,
> 			Set<Providersettings> providersettingses,
> 			Set<Providerlocations> providerlocationses) {
> 		this.internalspid = internalspid;
> 		this.timezonemaster = timezonemaster;
> 		this.majorcategorymaster = majorcategorymaster;
> 		this.serviceplanmaster = serviceplanmaster;
> 		this.statemaster = statemaster;
> 		this.countrymaster = countrymaster;
> 		this.serviceporviderid = serviceporviderid;
> 		this.businessname = businessname;
> 		this.website = website;
> 		this.videolink = videolink;
> 		this.describebusiness = describebusiness;
> 		this.describefacility = describefacility;
> 		this.registerphone = registerphone;
> 		this.registeremail = registeremail;
> 		this.paymenttype = paymenttype;
> 		this.languagesspeaks = languagesspeaks;
> 		this.picturemain = picturemain;
> 		this.picturelink2 = picturelink2;
> 		this.picturelink3 = picturelink3;
> 		this.picturelink4 = picturelink4;
> 		this.picturelink5 = picturelink5;
> 		this.dateupdated = dateupdated;
> 		this.userupdated = userupdated;
> 		this.ownerlastname = ownerlastname;
> 		this.ownerfirstname = ownerfirstname;
> 		this.dateregistered = dateregistered;
> 		this.numberoflocations = numberoflocations;
> 		this.numberofstaffs = numberofstaffs;
> 		this.status = status;
> 		this.overalluserrating = overalluserrating;
> 		this.encryptedpassword = encryptedpassword;
> 		this.secretquestion = secretquestion;
> 		this.secretanswer = secretanswer;
> 		this.providerstaffses = providerstaffses;
> 		this.providerinsurances = providerinsurances;
> 		this.providersettingses = providersettingses;
> 		this.providerlocationses = providerlocationses;
> 	}
> 
> 	// Property accessors
> 	@Id
> 	@GeneratedValue
> 	@Column(name = "INTERNALSPID", unique = true, nullable = false, precision
> = 10, scale = 0)
> 	public Long getInternalspid() {
> 		return this.internalspid;
> 	}
> 
> 	public void setInternalspid(Long internalspid) {
> 		this.internalspid = internalspid;
> 	}
> 
> 
> 	@ManyToOne(fetch = FetchType.EAGER)
> 	@JoinColumns( {
> 			@JoinColumn(name = "COUNTRYID", referencedColumnName = "COUNTRYID",
> nullable = false),
> 			@JoinColumn(name = "TIMEZONEID", referencedColumnName = "TIMEZONEID",
> nullable = false) })
> 	public Timezonemaster getTimezonemaster() {
> 		return this.timezonemaster;
> 	}
> 
> 	public void setTimezonemaster(Timezonemaster timezonemaster) {
> 		this.timezonemaster = timezonemaster;
> 	}
> 
> 	
> 	@ManyToOne(fetch = FetchType.EAGER )
> 	@JoinColumns( {
> 			@JoinColumn(name = "COUNTRYID", referencedColumnName = "COUNTRYID",
> nullable = false, insertable = false, updatable = false),
> 			@JoinColumn(name = "MAJORCATEGORY", referencedColumnName =
> "CATEGORYID", nullable = false, insertable = false, updatable = false) })
> 	public Majorcategorymaster getMajorcategorymaster() {
> 		return this.majorcategorymaster;
> 	}
> 
> 	public void setMajorcategorymaster(Majorcategorymaster
> majorcategorymaster) {
> 		this.majorcategorymaster = majorcategorymaster;
> 	}
> 
> 
> 	@ManyToOne(fetch = FetchType.EAGER)
> 	@JoinColumns( {
> 			@JoinColumn(name = "COUNTRYID", referencedColumnName = "COUNTRYID",
> nullable = false, insertable = false, updatable = false),
> 			@JoinColumn(name = "SERVICEPLAN", referencedColumnName =
> "SERVICETYPEID", nullable = false, insertable = false, updatable = false)
> })
> 	public Serviceplanmaster getServiceplanmaster() {
> 		return this.serviceplanmaster;
> 	}
> 
> 	public void setServiceplanmaster(Serviceplanmaster serviceplanmaster) {
> 		this.serviceplanmaster = serviceplanmaster;
> 	}
> 
> 	
> 	@ManyToOne(fetch = FetchType.EAGER)
> 	@JoinColumns( {
> 			@JoinColumn(name = "COUNTRYID", referencedColumnName = "COUNTRYID",
> nullable = false, insertable = false, updatable = false),
> 			@JoinColumn(name = "STATE", referencedColumnName = "STATEID", nullable
> = false, insertable = false, updatable = false) })
> 	public Statemaster getStatemaster() {
> 		return this.statemaster;
> 	}
> 
> 	public void setStatemaster(Statemaster statemaster) {
> 		this.statemaster = statemaster;
> 	}
> 
> 	@ManyToOne(fetch = FetchType.EAGER)
> 	@JoinColumn(name = "COUNTRYID", nullable = false, insertable = false,
> updatable = false)
> 	public Countrymaster getCountrymaster() {
> 		return this.countrymaster;
> 	}
> 
> 	public void setCountrymaster(Countrymaster countrymaster) {
> 		this.countrymaster = countrymaster;
> 	}
> 
> 	@Column(name = "SERVICEPORVIDERID", unique = true, nullable = false,
> length = 25)
> 	public String getServiceporviderid() {
> 		return this.serviceporviderid;
> 	}
> 
> 	public void setServiceporviderid(String serviceporviderid) {
> 		this.serviceporviderid = serviceporviderid;
> 	}
> 
> 	@Column(name = "BUSINESSNAME", nullable = false, length = 100)
> 	public String getBusinessname() {
> 		return this.businessname;
> 	}
> 
> 	public void setBusinessname(String businessname) {
> 		this.businessname = businessname;
> 	}
> 
> 	@Column(name = "WEBSITE", length = 100)
> 	public String getWebsite() {
> 		return this.website;
> 	}
> 
> 	public void setWebsite(String website) {
> 		this.website = website;
> 	}
> 
> 	@Column(name = "VIDEOLINK", length = 500)
> 	public String getVideolink() {
> 		return this.videolink;
> 	}
> 
> 	public void setVideolink(String videolink) {
> 		this.videolink = videolink;
> 	}
> 
> 	@Column(name = "DESCRIBEBUSINESS", nullable = false, length = 1000)
> 	public String getDescribebusiness() {
> 		return this.describebusiness;
> 	}
> 
> 	public void setDescribebusiness(String describebusiness) {
> 		this.describebusiness = describebusiness;
> 	}
> 
> 	@Column(name = "DESCRIBEFACILITY", length = 1000)
> 	public String getDescribefacility() {
> 		return this.describefacility;
> 	}
> 
> 	public void setDescribefacility(String describefacility) {
> 		this.describefacility = describefacility;
> 	}
> 
> 	@Column(name = "REGISTERPHONE", nullable = false, length = 60)
> 	public String getRegisterphone() {
> 		return this.registerphone;
> 	}
> 
> 	public void setRegisterphone(String registerphone) {
> 		this.registerphone = registerphone;
> 	}
> 
> 	@Column(name = "REGISTEREMAIL", nullable = false, length = 60)
> 	public String getRegisteremail() {
> 		return this.registeremail;
> 	}
> 
> 	public void setRegisteremail(String registeremail) {
> 		this.registeremail = registeremail;
> 	}
> 
> 	@Column(name = "PAYMENTTYPE", length = 100 )
> 	public String getPaymenttype() {
> 		return this.paymenttype;
> 	}
> 
> 	public void setPaymenttype(String paymenttype) {
> 		this.paymenttype = paymenttype;
> 	}
> 
> 	@Column(name = "LANGUAGESSPEAKS", nullable = false, length = 60)
> 	public String getLanguagesspeaks() {
> 		return this.languagesspeaks;
> 	}
> 
> 	public void setLanguagesspeaks(String languagesspeaks) {
> 		this.languagesspeaks = languagesspeaks;
> 	}
> 
> 	@Column(name = "PICTUREMAIN")
> 	public String getPicturemain() {
> 		return this.picturemain;
> 	}
> 
> 	public void setPicturemain(String picturemain) {
> 		this.picturemain = picturemain;
> 	}
> 
> 	@Column(name = "PICTURELINK2")
> 	public String getPicturelink2() {
> 		return this.picturelink2;
> 	}
> 
> 	public void setPicturelink2(String picturelink2) {
> 		this.picturelink2 = picturelink2;
> 	}
> 
> 	@Column(name = "PICTURELINK3")
> 	public String getPicturelink3() {
> 		return this.picturelink3;
> 	}
> 
> 	public void setPicturelink3(String picturelink3) {
> 		this.picturelink3 = picturelink3;
> 	}
> 
> 	@Column(name = "PICTURELINK4")
> 	public String getPicturelink4() {
> 		return this.picturelink4;
> 	}
> 
> 	public void setPicturelink4(String picturelink4) {
> 		this.picturelink4 = picturelink4;
> 	}
> 
> 	@Column(name = "PICTURELINK5")
> 	public String getPicturelink5() {
> 		return this.picturelink5;
> 	}
> 
> 	public void setPicturelink5(String picturelink5) {
> 		this.picturelink5 = picturelink5;
> 	}
> 
> 	//@Temporal(TemporalType.TIMESTAMP)
> 	@Column(name = "DATEUPDATED", length = 7)
> 	public Timestamp getDateupdated() {
> 		return this.dateupdated;
> 	}
> 
> 	public void setDateupdated(Timestamp dateupdated) {
> 		this.dateupdated = dateupdated;
> 	}
> 
> 	@Column(name = "USERUPDATED", length = 60)
> 	public String getUserupdated() {
> 		return this.userupdated;
> 	}
> 
> 	public void setUserupdated(String userupdated) {
> 		this.userupdated = userupdated;
> 	}
> 
> 	@Column(name = "OWNERLASTNAME", length = 30)
> 	public String getOwnerlastname() {
> 		return this.ownerlastname;
> 	}
> 
> 	public void setOwnerlastname(String ownerlastname) {
> 		this.ownerlastname = ownerlastname;
> 	}
> 
> 	@Column(name = "OWNERFIRSTNAME", length = 30)
> 	public String getOwnerfirstname() {
> 		return this.ownerfirstname;
> 	}
> 
> 	public void setOwnerfirstname(String ownerfirstname) {
> 		this.ownerfirstname = ownerfirstname;
> 	}
> 
> 	//@Temporal(TemporalType.TIMESTAMP)
> 	@Column(name = "DATEREGISTERED", length = 7)
> 	public Timestamp getDateregistered() {
> 		return this.dateregistered;
> 	}
> 
> 	public void setDateregistered(Timestamp dateregistered) {
> 		this.dateregistered = dateregistered;
> 	}
> 
> 	@Column(name = "NUMBEROFLOCATIONS", precision = 2, scale = 0)
> 	public Byte getNumberoflocations() {
> 		return this.numberoflocations;
> 	}
> 
> 	public void setNumberoflocations(Byte numberoflocations) {
> 		this.numberoflocations = numberoflocations;
> 	}
> 
> 	@Column(name = "NUMBEROFSTAFFS", precision = 2, scale = 0)
> 	public Byte getNumberofstaffs() {
> 		return this.numberofstaffs;
> 	}
> 
> 	public void setNumberofstaffs(Byte numberofstaffs) {
> 		this.numberofstaffs = numberofstaffs;
> 	}
> 
> 	@Column(name = "STATUS", length = 1)
> 	public String getStatus() {
> 		return this.status;
> 	}
> 
> 	public void setStatus(String status) {
> 		this.status = status;
> 	}
> 
> 	@Column(name = "OVERALLUSERRATING", precision = 2, scale = 1)
> 	public Double getOveralluserrating() {
> 		return this.overalluserrating;
> 	}
> 
> 	public void setOveralluserrating(Double overalluserrating) {
> 		this.overalluserrating = overalluserrating;
> 	}
> 
> 	@Column(name = "ENCRYPTEDPASSWORD", length = 50)
> 	public String getEncryptedpassword() {
> 		return this.encryptedpassword;
> 	}
> 
> 	public void setEncryptedpassword(String encryptedpassword) {
> 		this.encryptedpassword = encryptedpassword;
> 	}
> 
> 	@Column(name = "SECRETQUESTION", length = 50)
> 	public String getSecretquestion() {
> 		return this.secretquestion;
> 	}
> 
> 	public void setSecretquestion(String secretquestion) {
> 		this.secretquestion = secretquestion;
> 	}
> 
> 	@Column(name = "SECRETANSWER", length = 50)
> 	public String getSecretanswer() {
> 		return this.secretanswer;
> 	}
> 
> 	public void setSecretanswer(String secretanswer) {
> 		this.secretanswer = secretanswer;
> 	}
> 
> 	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy =
> "serviceprovider")
> 	public Set<Providerstaffs> getProviderstaffses() {
> 		return this.providerstaffses;
> 	}
> 
> 	public void setProviderstaffses(Set<Providerstaffs> providerstaffses) {
> 		this.providerstaffses = providerstaffses;
> 	}
> 
> 	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy =
> "serviceprovider")
> 	public Set<Providerinsurance> getProviderinsurances() {
> 		return this.providerinsurances;
> 	}
> 
> 	public void setProviderinsurances(Set<Providerinsurance>
> providerinsurances) {
> 		this.providerinsurances = providerinsurances;
> 	}
> 
> 	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy =
> "serviceprovider")
> 	public Set<Providersettings> getProvidersettingses() {
> 		return this.providersettingses;
> 	}
> 
> 	public void setProvidersettingses(Set<Providersettings>
> providersettingses) {
> 		this.providersettingses = providersettingses;
> 	}
> 
> 	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy =
> "serviceprovider")
> 	public Set<Providerlocations> getProviderlocationses() {
> 		return this.providerlocationses;
> 	}
> 
> 	public void setProviderlocationses(
> 			Set<Providerlocations> providerlocationses) {
> 		this.providerlocationses = providerlocationses;
> 	}
> 
> }
> 
> [/code]
> 
> [b]Code between sessionFactory.openSession() and session.close():[/b]
> [code]
> @Transactional
> 	public void saveSP(Serviceprovider entity, 
> 			byte countryFK1,String stateFK2,byte MajorcFK3,
> 			double timeZFK){
> 		try {		
> 			
> entity.setCountrymaster(entityManager.getReference(Countrymaster.class,
> countryFK1));
> 				Statemaster sm=entityManager.getReference(Statemaster.class, new
> StatemasterId(countryFK1,stateFK2));
> 				entity.setStatemaster(sm);
> 				System.out.println(entity.getStatemaster().getDescription());
> 			
> entity.setTimezonemaster(entityManager.getReference(Timezonemaster.class,
> new TimezonemasterId(countryFK1,timeZFK)));
> 				Majorcategorymaster
> mcm=entityManager.getReference(Majorcategorymaster.class, new
> MajorcategorymasterId(countryFK1,MajorcFK3));
> 				entity.setMajorcategorymaster(mcm);
> 				System.out.println(entity.getMajorcategorymaster().getDescription());
> 				entityManager.persist(entity);
> 		} catch (Exception e) {
> 			e.printStackTrace();
> 		}
> 		
> 	}
> 
> 	
> 	private EntityManager entityManager;
> 
> 	@PersistenceContext
> 	public void setEntityManager(EntityManager entityManager) {
> 		this.entityManager = entityManager;
> 		
> 	}
> 	public EntityManager getEntityManager() {
> 		return entityManager;
> 	}
> 
> [/code]
> [b]I'm trying to run this with my main class :[/b]
> [code]
> public class ServiceprovidesMain {
> 	byte countryid=1;
> 	String SERVICEPROVIDERID="akirti1";
> 	String BUSINESSNAME="sw1";
> 	String STATE="AL";
> 	double TIMEZONE=-5;
> 	byte MAJORCATEGORY=1;
> 	byte MAJORSPECIALITY=1;
> 	byte SERVICEPALN=1;
> 	String RegisterPHONE="909090909";
> 	String RegisterEMAIL="akirti@gmailcom";
> 	byte NumberOfLOCA=1;
> 	byte NumberOfSTAFF=1;
> 	String EncryptedPASS="pasword";
> 	String DESCBUSINESS="software java";
> 	private BeanFactory factory;
> 	public void runtst(Serviceprovider entity){
> 		IServiceproviderDAO
> spdaoint=(IServiceproviderDAO)factory.getBean("IServiceproviderDAO");
> 		System.out.println(spdaoint+"<---- grrr");
> 		spdaoint.save(entity);
> 		
> 	}
> 
> public void run3(){
> 		ClassPathXmlApplicationContext appContext = new
> ClassPathXmlApplicationContext( new String[]
> {"applicationContext-dao.xml","applicationContext-service.xml",
> "applicationContext-resources.xml"});
> 		factory= (BeanFactory)appContext;
> 		System.out.println(factory+"<----BEAN FACTORY");
> 		IServiceproviderDAO
> spdaoint=(IServiceproviderDAO)factory.getBean("IServiceproviderDAO");
> 		Serviceprovider sp=new Serviceprovider();
> 		sp.setServiceporviderid(SERVICEPROVIDERID);
> 		sp.setBusinessname(BUSINESSNAME);
> 		sp.setRegisterphone(RegisterPHONE);
> 		sp.setRegisteremail(RegisterEMAIL);
> 		sp.setNumberoflocations(NumberOfLOCA);
> 		sp.setNumberofstaffs(NumberOfSTAFF);
> 		sp.setEncryptedpassword(EncryptedPASS);
> 		sp.setDescribebusiness(DESCBUSINESS);
> 		sp.setLanguagesspeaks("HINDI");
> 		spdaoint.saveSP(sp, countryid, STATE, MAJORCATEGORY, TIMEZONE);
> 
> 		
> 	}
> 	
> 	
> 	public static void main(String[] args) {
> 		try {
> 			new ServiceprovidesMain().run3();
> 		} catch (Exception e) {
> 			e.printStackTrace();
> 		}
> 		
> 	}
> }
> [/code]
> 
> [b]My stack trace of exception that occurs are as follows:[/b]
> [code]
> log4j:WARN No appenders could be found for logger
> (org.springframework.context.support.ClassPathXmlApplicationContext).
> log4j:WARN Please initialize the log4j system properly.
> com.speduler.dao.impl.SpAdminDAOimpl@1c6a99d<-----ispadmindao----
> org.springframework.context.support.ClassPathXmlApplicationContext@145d068:
> display name
> [org.springframework.context.support.ClassPathXmlApplicationContext@145d068];
> startup date [Tue Jan 20 17:20:35 IST 2009]; root of context
> hierarchy<----BEAN FACTORY
> Hibernate: select statemaste0_.COUNTRYID as COUNTRYID0_0_,
> statemaste0_.STATEID as STATEID0_0_, statemaste0_.DESCRIPTION as
> DESCRIPT3_0_0_ from S2LLC.STATEMASTER statemaste0_ where
> statemaste0_.COUNTRYID=? and statemaste0_.STATEID=?
> Alabama
> Hibernate: select majorcateg0_.CATEGORYID as CATEGORYID23_0_,
> majorcateg0_.COUNTRYID as COUNTRYID23_0_, majorcateg0_.DESCRIPTION as
> DESCRIPT3_23_0_ from S2LLC.MAJORCATEGORYMASTER majorcateg0_ where
> majorcateg0_.CATEGORYID=? and majorcateg0_.COUNTRYID=?
> Artist
> Hibernate: select hibernate_sequence.nextval from dual
> Hibernate: insert into S2LLC.SERVICEPROVIDER (BUSINESSNAME,
> DESCRIBEBUSINESS, ENCRYPTEDPASSWORD, LANGUAGESSPEAKS, NUMBEROFLOCATIONS,
> NUMBEROFSTAFFS, REGISTEREMAIL, REGISTERPHONE, SERVICEPORVIDERID,
> COUNTRYID, TIMEZONEID, INTERNALSPID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
> ?, ?)
> org.springframework.transaction.TransactionSystemException: Could not
> commit JPA transaction; nested exception is
> javax.persistence.RollbackException: Error while commiting the transaction
> Caused by: javax.persistence.RollbackException: Error while commiting the
> transaction
> 	at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:71)
> 	at
> org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:434)
> 	at
> org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:662)
> 	at
> org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:632)
> 	at
> org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:314)
> 	at
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)
> 	at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
> 	at
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
> 	at $Proxy25.saveSP(Unknown Source)
> 	at mainmethod.ServiceprovidesMain.run3(ServiceprovidesMain.java:239)
> 	at mainmethod.ServiceprovidesMain.main(ServiceprovidesMain.java:247)
> Caused by: org.hibernate.exception.ConstraintViolationException: Could not
> execute JDBC batch update
> 	at
> org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)
> 	at
> org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
> 	at
> org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
> 	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)
> 	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
> 	at
> org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
> 	at
> org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
> 	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
> 	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:365)
> 	at
> org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)
> 	at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:54)
> 	... 10 more
> Caused by: java.sql.BatchUpdateException: ORA-01400: cannot insert NULL
> into ("S2LLC"."SERVICEPROVIDER"."MAJORCATEGORY")
> 
> 	at
> oracle.jdbc.dbaccess.DBError.throwBatchUpdateException(DBError.java:458)
> 	at
> oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:3907)
> 	at
> org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
> 	at
> org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
> 	... 18 more
> 
> [/code]
> 
> 
> [b]Name and version of the database you are using:[/b]
> I'm using Oracle10g 
> 
> 
> [b]The generated SQL (show_sql=true):[/b]
> 
> 
> com.speduler.dao.impl.SpAdminDAOimpl@1c6a99d<-----ispadmindao----
> org.springframework.context.support.ClassPathXmlApplicationContext@145d068:
> display name
> [org.springframework.context.support.ClassPathXmlApplicationContext@145d068];
> startup date [Tue Jan 20 17:20:35 IST 2009]; root of context
> hierarchy<----BEAN FACTORY
> Hibernate: select statemaste0_.COUNTRYID as COUNTRYID0_0_,
> statemaste0_.STATEID as STATEID0_0_, statemaste0_.DESCRIPTION as
> DESCRIPT3_0_0_ from S2LLC.STATEMASTER statemaste0_ where
> statemaste0_.COUNTRYID=? and statemaste0_.STATEID=?
> Alabama
> Hibernate: select majorcateg0_.CATEGORYID as CATEGORYID23_0_,
> majorcateg0_.COUNTRYID as COUNTRYID23_0_, majorcateg0_.DESCRIPTION as
> DESCRIPT3_23_0_ from S2LLC.MAJORCATEGORYMASTER majorcateg0_ where
> majorcateg0_.CATEGORYID=? and majorcateg0_.COUNTRYID=?
> Artist
> Hibernate: select hibernate_sequence.nextval from dual
> Hibernate: insert into S2LLC.SERVICEPROVIDER (BUSINESSNAME,
> DESCRIBEBUSINESS, ENCRYPTEDPASSWORD, LANGUAGESSPEAKS, NUMBEROFLOCATIONS,
> NUMBEROFSTAFFS, REGISTEREMAIL, REGISTERPHONE, SERVICEPORVIDERID,
> COUNTRYID, TIMEZONEID, INTERNALSPID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
> ?, ?)
> 
> 
> [b]Debug level Hibernate log excerpt:[/b]
> I saw during debugging that my entity which I want to save doesn't have
> the referencey of proerties like majorCategoryMastet,TimeZonemaster..
> which are FK in this table. appears null while I'm setting all the values
> after entityManager.getReference(*class,new Object(id)); but still its
> null. 
> 
> It seems like my select and insert appears in different different
> entityManager. i'm not sure but may be.. please help in resolving this
> issue.. i'm unable to deal with this. how to solve..
> 
> once I tried to to remove my annotaion @Manytoone @JoinColum(....)
> from insertable=false, updatable=false but then my application not loaded
> and give error at loading thine and say no entityManagerFactory and error
> in annotation for insertable=false ,updatable=false.
> 
> how to deal with ..please help me. I'm new to all this but I'm trying hard
> to resolve this..
> 
> Hi All,
> 
> my mapping of
> 
> 
> @ManyToOne(fetch = FetchType.EAGER)
>    @JoinColumns( {
>          @JoinColumn(name = "COUNTRYID", referencedColumnName =
> "COUNTRYID", nullable = false, insertable = false, updatable = false),
>          @JoinColumn(name = "STATE", referencedColumnName = "STATEID",
> nullable = false, insertable = false, updatable = false) })
>    public Statemaster getStatemaster() {
>       return this.statemaster;
>    }
> 
> 
> 
> 
> @ManyToOne(fetch = FetchType.LAZY)
>    @JoinColumns( {
>          @JoinColumn(name = "COUNTRYID", referencedColumnName =
> "COUNTRYID", nullable = false, insertable = false, updatable = false),
>          @JoinColumn(name = "STATE", referencedColumnName = "STATEID",
> nullable = false, insertable = false, updatable = false) })
>    public Statemaster getStatemaster() {
>       return this.statemaster;
>    }
> 
> 
> 
> I tried with both.. but no effect.
> 
> TIA
> regards
> Akirti  
> 
> 
> 
> 


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/Problem-in-persist-due-to-rollback-tp21561891p21564901.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top