-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate Error: org.hibernate.NonUniqueObjectException
PostPosted: Sat May 28, 2016 8:02 am 
Newbie

Joined: Sat May 28, 2016 7:42 am
Posts: 1
I try to create a new zone :

Code:
Zone zoneDao= ZoneDao.getZoneByName(zoneDetail.getName());
if (zoneDao !=null) //zone exist
else{
    Zone insertZone = new Zone();
    ....   

    insertZone.setZoneName(zoneDetail.getName()); //OK
    insertZone.setStationList(zoneStationSet); //OK
    zoneDAO.saveOrUpdate(insertZone); // //exception NonUniqueObjectException




I have the **Hibernate NonUniqueObjectException**
really 2days I try diffrents solution and I don't check where is my mistakes

For the stack trace:

Code:
    org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.airfrance.vtruck.entity.ZoneStation#ZoneStationId [zoneId=null, stationCode=]]
       at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:190)
       at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:143)
       at org.hibernate.ejb.event.EJB3SaveOrUpdateEventListener.saveWithGeneratedId(EJB3SaveOrUpdateEventListener.java:62)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:117)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
       at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:685)
       at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:677)
       at org.hibernate.engine.CascadingAction$5.cascade(CascadingAction.java:252)
       at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:392)
       at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:335)
       at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:204)
       at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:425)
       at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:362)
       at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:338)
       at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:204)
       at org.hibernate.engine.Cascade.cascade(Cascade.java:161)
       at org.hibernate.engine.Cascade.cascade(Cascade.java:127)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.cascadeOnUpdate(DefaultSaveOrUpdateEventListener.java:376)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performUpdate(DefaultSaveOrUpdateEventListener.java:350)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsDetached(DefaultSaveOrUpdateEventListener.java:246)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:112)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
       at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:685)
       at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:677)
       at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:673)
       at com.afklm.jraf.provider.persistence.hibernate.AbstractDAOGenericImpl.saveOrUpdateNoFlush(AbstractDAOGenericImpl.java:640)
       ... 71 more


Thanks for your response and sorry for my bad english ;)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.