From: Ecmel E. (JIRA) <no...@at...> - 2006-05-23 16:30:25
|
Extra Lazy collection, wrong size --------------------------------- Key: HHH-1776 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1776 Project: Hibernate3 Type: Bug Versions: 3.2.0.cr2 Environment: HSQLDB 1.8.0.4 Reporter: Ecmel Ercan I have the following mappings: <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> <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: System.out.println(parent.getChildren().size()); the following query is issued: 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 -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |