-->
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.  [ 2 posts ] 
Author Message
 Post subject: Problem with multiple collections
PostPosted: Wed Dec 01, 2010 6:27 pm 
Newbie

Joined: Wed Dec 01, 2010 6:12 pm
Posts: 2
Hi all,

i'm new to hibernate ad i have a frustating problem that, i think, has a simple solution.

I have an object with three collections like described by the mapping file below

Code:
<class name="AClass" table="atable">
    <id name="aclassid" column="aclassid">
        <generator class="native"/>
    </id>
    <set name="s1" cascade="all,delete-orphan">
        <key column="aid" not-null="true"/>
        <one-to-many class="S1"/>
    </set>
    <set name="s2" cascade="all,delete-orphan">
        <key column="aid" not-null="true"/>
        <one-to-many class="S2"/>
    </set>
    <set name="s3" cascade="all,delete-orphan">
        <key column="aid" not-null="true"/>
        <one-to-many class="S3"/>
    </set>
  </class>


the problem is when i call session.refresh on that object.
Looking in the sql generated by hibernate seems that only the query to populate the first collection in the mapping file is done, the others are skipped.
So if i change the order in the mapping file by placing S2 first, only S2 is populated

Anyone has some solutions?

Thanks


Top
 Profile  
 
 Post subject: Re: Problem with multiple collections
PostPosted: Wed Dec 01, 2010 7:33 pm 
Newbie

Joined: Wed Dec 01, 2010 6:12 pm
Posts: 2
Solved,

it was my mistake, i close the session before all collections are correctly populated


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.