-->
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 newby, two open session error
PostPosted: Thu Jun 21, 2007 8:25 am 
Newbie

Joined: Thu Jun 21, 2007 8:04 am
Posts: 1
I have an object which contains a collection that contains a set and I get the "Illegal attempt to associate a collection with two open sessions" error when I try to remove the last member of the main collection.

So TABLE A contains a collection of 0 or more of TABLE B. TABLE B may or may not have a set of TABLE C.

The mapping for TABLE B is :

<class name="Company" table="TABLE_B">
..
..
..
<set name="divisions" table="TABLE_B_C">
<key column="TABLE_B_ID>
<many-to-many column="DIVISION_ID" class="Division"/>
</set>
</class>

TABLE_B_C is the mapping table that has a composite primary key of TABLE_B|TABLE_C. These are foreign keys to there respective tables.

Data in TABLE_B can exist without an association to TABLE_C and vice versa.

The error does not occur when Company actually has divisions mapped to it.

Can I do this? Is there another way to map this?

I am using hibernate 2.


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.