-->
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: Extra Lazy collection, wrong size
PostPosted: Mon May 15, 2006 5:54 pm 
Newbie

Joined: Wed May 10, 2006 9:09 am
Posts: 13
Hello,

I am using Hibernate 3.2 CR2.

I have the following mappings:


Code:
<hibernate-mapping>

    <class name="TestParent" table="TESTPARENT">
        <id name="id" column="ID">
            <generator class="native"/>
        </id>

        <list name="children" lazy="extra">
            <key column="PARENT_ID" />
            <list-index column="id"/>
            <one-to-many class="TestChild" />
        </list>
               
    </class>
   
</hibernate-mapping>



Code:
<hibernate-mapping>

    <class name="TestChild" table="TESTCHILD">
        <id name="id" column="ID">
            <generator class="native"/>
        </id>
               
        <many-to-one name="parent" column="id" class="TestParent" />       
   
    </class>
 
</hibernate-mapping>


When I get the size of the children by:

Code:
System.out.println(parent.getChildren().size());


the following query is issued:

Code:
select max(id) + 1 from TESTCHILD where PARENT_ID =?


This assumes a sequential id column with no deleted rows. I expect a count(id) query.

Strangely, if I map the same class with annotations, a count(id) query is issued, but the collection will not be extra lazy as I mentioned in the annotations forum: http://forum.hibernate.org/viewtopic.php?t=959249


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 23, 2006 5:30 am 
Newbie

Joined: Wed May 10, 2006 9:09 am
Posts: 13
Is this a bug? Should I report it?


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.