-->
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: mapped collection contains 100000 items but query returned 5
PostPosted: Mon Oct 04, 2004 5:57 pm 
Newbie

Joined: Mon Oct 04, 2004 5:33 pm
Posts: 2
Location: Austin, Tx
Hibernate version:2.1.6

Below is a System.out and stack trace that I added to the set method of a mapped class which takes a collection. Note the size of the List set into my object is 100000 even though the generated sql only returns some 15 rows.

I cannot see anything abnormal in the debug statements. Any suggestions would be appreciated.

[java] net.sf.hibernate.collection.List:size=100000
[java] java.lang.Exception: Stack trace
[java] at java.lang.Thread.dumpStack(Thread.java:1064)
[java] at com.activant.biz.inventory.impl.LineImpl.setSubLinesLineImpl.java:49)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:324)
[java] at net.sf.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:38)
[java] at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:222)
[java] at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:2210)
[java] at net.sf.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:315)
[java] at net.sf.hibernate.loader.Loader.doQuery(Loader.java:305)
[java] at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
[java] at net.sf.hibernate.loader.Loader.doList(Loader.java:1033)
[java] at net.sf.hibernate.loader.Loader.list(Loader.java:1024)
[java] at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:854)
[java] at net.sf.hibernate.impl.SessionImpl.findSessionImpl.java:1544)
[java] at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)

Here's the relevant mapping information. I question whether this is a mapping problem because the generated sql is correct and I only see the returned rows getting intialized. Behavior is consistent when lazy if true and false.

<subclass name="com.activant.biz.inventory.impl.LineImpl"
proxy="com.activant.biz.inventory.model.Line"
lazy="true"
discriminator-value="L">
<list name="subLines" lazy="false" where="CLASS='S'">
<key column="PARENT_ID"/>
<index column="LINE_SEQ"/>
<one-to-many class="com.activant.biz.inventory.impl.SubLineImpl"/>
</list>
<set name="items" lazy="true" inverse="true" sort="natural">
<key column="LINE_ID"/>
<one-to-many class="com.activant.biz.inventory.impl.ItemImpl"/>
</set>
</subclass>

<subclass name="com.activant.biz.inventory.impl.SubLineImpl"
proxy="com.activant.biz.inventory.model.SubLine"
lazy="true" discriminator-value="S">
<set name="items" lazy="true" inverse="true" sort="natural">
<key column="SL_ID"/>
<one-to-many class="com.activant.biz.inventory.impl.ItemImpl"/>
</set>
</subclass>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 04, 2004 6:58 pm 
Newbie

Joined: Mon Oct 04, 2004 5:33 pm
Posts: 2
Location: Austin, Tx
Ain't Legacy Data Fun????

Since posting, I walked the hibernate source to find my list being initialize to 1+ the max value of my index column which was 99999. Guess I'm using a set...


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.