-->
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: Problem with using <list>...
PostPosted: Fri Jun 01, 2007 11:49 am 
Newbie

Joined: Fri Dec 22, 2006 6:44 pm
Posts: 7
I'm using a <list> to represent a collection for one of my business objects, but when the results get returned to me I get more than expected. For example, when I expect to have a collection of 3 objects I actually get one with 47 objects, 3 of which are the actual ones and the rest just being null (or nothing). What am I doing wrong?

Here's an example of my mapping files...

<class name="Cart" table="tCarts" proxy="ICart">
<id name="ID" column="ID">
<generator class="native" />
</id>

<list name="CartItems" lazy="false" fetch="join" cascade="save-update">
<key column="CartID" />
<index column="ID" />
<one-to-many class="CartItem" />
</list>
</class>

<class name="CartItem" table="tCartItems" proxy="ICartItem">
<id name="ID" column="ID">
<generator class="native" />
</id>

<many-to-one name="ParentCart" column="CartID" class="Cart" fetch="join" />
</class>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 01, 2007 4:10 pm 
Newbie

Joined: Fri Dec 22, 2006 6:44 pm
Posts: 7
After looking into it a little bit it seems that when a new snapshot of the current state of my collection gets returned, a temporary List<T> is being instantiated with the size of the current collection state, which is 47. Then a deep copy of each object in that collection is being added into the temporary one, which is later returned when done. But why would my current snapshot have 47 items in it when every sql statement that is generated only returns 3 items (I ran the generated sql manually and it worked as I thought it would)?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 01, 2007 4:29 pm 
Newbie

Joined: Fri Dec 22, 2006 6:44 pm
Posts: 7
Oops... Nevermind, it would help if I read some of the documentation before I posted :-p


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.