-->
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.  [ 3 posts ] 
Author Message
 Post subject: Shared references to a collection
PostPosted: Thu Mar 11, 2004 5:00 pm 
Beginner
Beginner

Joined: Fri Oct 10, 2003 10:12 am
Posts: 39
hello,

i've been getting the following error when initializing a lazy collection:

Code:
net.sf.hibernate.HibernateException: Found shared references to a collection
   at net.sf.hibernate.impl.SessionImpl.updateReachableCollection(SessionImpl.java:2759)
   at net.sf.hibernate.impl.FlushVisitor.processCollection(FlushVisitor.java:32)
   at net.sf.hibernate.impl.AbstractVisitor.processValue(AbstractVisitor.java:69)
   at net.sf.hibernate.impl.AbstractVisitor.processValues(AbstractVisitor.java:36)
   at net.sf.hibernate.impl.SessionImpl.flushEntity(SessionImpl.java:2474)
   at net.sf.hibernate.impl.SessionImpl.flushEntities(SessionImpl.java:2340)
   at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2207)
   at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2186)
   at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)

and it says in the hibernate docs:
Quote:
Collections obey the usual rules for value types: no shared references, created and deleted along with containing entity.


could someone clarify what this means and what i should do to stop this from happening?

thanks, cam


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 11, 2004 9:18 pm 
Newbie

Joined: Thu Mar 11, 2004 5:13 am
Posts: 5
I meet such problem two days ago
And the reason is in may meta-model
A subclass declear the same attribute of it's super class

Such as:
ClassB{ String test; }
ClassA extends ClassB {String test;}

Then if you mapping this meta-model into to mapping file
Truely, you will get the problem you said.

I removed duplicate attribute then such problem disaapeared.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 12, 2004 9:14 am 
Beginner
Beginner

Joined: Fri Oct 10, 2003 10:12 am
Posts: 39
thanks - this wasn't the problem in this case through, i'd accidently been referencing the same collection in two get\set pairs - the problem with copy\paste...
cam


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

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.