-->
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: "Different object with same identifier" in empty s
PostPosted: Fri Mar 04, 2005 10:14 am 
Newbie

Joined: Wed Sep 29, 2004 10:36 am
Posts: 8
Location: Berlin, Germany
Hibernate version: 2.1.7

Full stack trace of any exception that occurs:
Code:
Caused by: net.sf.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: 31, of class: FooBar
        at net.sf.hibernate.impl.SessionImpl.checkUniqueness(SessionImpl.java:1686)
        at net.sf.hibernate.impl.SessionImpl.doUpdateMutable(SessionImpl.java:1452)
        at net.sf.hibernate.impl.SessionImpl.doUpdate(SessionImpl.java:1479)
        at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1402)
        at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114)
        at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436)
        at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503)
        at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:482)
        at net.sf.hibernate.impl.SessionImpl.doUpdate(SessionImpl.java:1484)
        at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1402)
        at org.springframework.orm.hibernate.HibernateTemplate$14.doInHibernate(HibernateTemplate.java:390)
        at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:228)
        ... 62 more



Hi,

I've read about this exception, so I think I know what it means.

However, I am completely clueless, how this exception ever can occur when calling a saveOrUpdate(obj) with an empty session. The object to be saved was loaded before via session.load(class, id) in a former HTTP request and not altered. I'm using the OpenSessionInView filter of Spring. To be sure I invoked session.clear() before saveOrUpdate().

So obj is a detached instance. In fact every object in the graph spanned by obj is detached.

Does it mean that this is Hibernate's fault?
Any idea where to investigate?

Oliver


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.