jeudi 19 février 2015

Hibernate entityManager.merge() giving : java.sql.SQLIntegrityConstraintViolationException: ORA-01400: cannot insert NULL into

I am trying to insert a new entry to a table more like



entityManager.merge(applicationInformation);
entityManager.flush();


Where "applicationInformation" is my entity object. Which have all the new values for the new record set in it. I checked if applicationInformation really have the values in it by calling its get methods. But it is giving me the error when trying to merge i guess. My log says





INFO [http-bio-80-exec-1] (ApplicationInformationRepo.java:47) - Code of application : restaurant is :1
INFO [http-bio-80-exec-1] (ApplicationInformationRepo.java:52) - Insert elements
INFO [http-bio-80-exec-1] (ApplicationInformationRepo.java:54) - Inserted ApplicationTypeCode: 1
INFO [http-bio-80-exec-1] (ApplicationInformationRepo.java:56) - Inserted loc num: 999
INFO [http-bio-80-exec-1] (ApplicationInformationRepo.java:58) - Inserted menu id: 8002
INFO [http-bio-80-exec-1] (ApplicationInformationCfgRepo.java:60) - Inserted store id: 1218
Merging the object!!!

DEBUG [http-bio-80-exec-1] (Loader.java:2099) - Loading entity: [com.heb.jaf.entity.ApplicationInformation#component[storeDataId,menuDataId,locationNumber,applicationTypeCode]{locationNumber=999, applicationTypeCode=1 , storeDataId=1218, menuDataId=8002}]
DEBUG [http-bio-80-exec-1] (SqlStatementLogger.java:104) - select applicatio0_.STR_DTA__ID as STR1_4_0_, applicatio0_.MENU_DTA__ID as MENU2_4_0_, applicatio0_.LOC_NBR as LOC3_4_0_, applicatio0_.APPL_TYP_CD as APPL4_4_0_ from APPL_INFO_ applicatio0_ where applicatio0_.STR_DTA__ID=? and applicatio0_.MENU_DTA__ID=? and applicatio0_.LOC_NBR=? and applicatio0_.APPL_TYP_CD=?
DEBUG [http-bio-80-exec-1] (Loader.java:2123) - Done entity load
DEBUG [http-bio-80-exec-1] (AbstractSaveEventListener.java:131) - Generated identifier: component[storeDataId,menuDataId,locationNumber,applicationTypeCode]{locationNumber=null, applicationTypeCode=null, storeDataId=null, menuDataId=null}, using strategy: org.hibernate.id.CompositeNestedGeneratedValueGenerator
DEBUG [http-bio-80-exec-1] (AbstractFlushingEventListener.java:143) - Processing flush-time cascades
DEBUG [http-bio-80-exec-1] (AbstractFlushingEventListener.java:183) - Dirty checking collections
DEBUG [http-bio-80-exec-1] (AbstractFlushingEventListener.java:117) - Flushed: 1 insertions, 0 updates, 0 deletions to 2 objects
DEBUG [http-bio-80-exec-1] (AbstractFlushingEventListener.java:124) - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
DEBUG [http-bio-80-exec-1] (EntityPrinter.java:114) - Listing entities:
DEBUG [http-bio-80-exec-1] (EntityPrinter.java:121) - com.heb.jaf.entity.ApplicationType{applicationTypeDescription=restaurant, applicationTypeCode=1 }
DEBUG [http-bio-80-exec-1] (EntityPrinter.java:121) - com.heb.jaf.entity.ApplicationInformation{}



In my localhost log i got an exception like:





javax.persistence.RollbackException: Transaction marked as rollbackOnly


So when i am trying to merge i am loosing the content in ApplicationInformation. What can be the possible cause? I have mentioned the entity classes in persistance.xml and i am using @Transactional properly too. The same procedure i followed for this method updates two other Tables s I am working with. The problem persists only for this table. All the 4 fields in this table are foreign and all are declared as id. What am I doing wrong?


Aucun commentaire:

Enregistrer un commentaire