-->
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: List problem
PostPosted: Tue Aug 15, 2006 2:04 am 
Newbie

Joined: Thu Oct 13, 2005 3:51 am
Posts: 2
Hibernate version:3.1.3


<class name = "mappingClass.PrenatalRecord" lazy="false">
<id name="id" type="java.lang.Integer">
<column name="ID_KEY" sql-type="integer" not-null="true"/>
<generator class="increment"/>
</id>

<list name="completeOperations"
table="LIST_PRENATAL_RECORD_OPERATION" lazy="false">
<key column="ID_PRENATAL_RECORD"/>
<list-index column="sortOrder"/>
<composite-element class="mappingClass.CompleteOperation">
<many-to-one fetch="join" name="operation" column="ID_OPERATION" class="mappingClass.Operation"/>
<property name="timeDoing" type="java.lang.String" length="20"/>
<many-to-one fetch="join" name="narkoz" class="mappingClass.Narkoz" column="ID_NARKOZ" not-null="false"/>
<many-to-one fetch="join" name="complication" column="ID_COMPLICATION" class="mappingClass.Complication"/>
<many-to-one fetch="join" name="doctor" class="mappingClass.Employee" column="ID_EMPLOYEE" foreign-key="FK_EMP_PREREC" not-null="true"/>
</composite-element>
</list>
</class>



When I'll doing

Code:
HibernateUtil.getCurrentSession().createCriteria(PrenatalRecord.class).setCacheable(true).list();


I have java.util.List with duplicate record of PrenatalRecord.class.
I.e. I have identical record of PrenatalRecord so much, how much record in LIST_PRENATAL_RECORD_OPERATIONS table (or completeOperations collection).
Lazy = "false" - necessary condition.

What I doing incorrectly?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 15, 2006 6:14 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Code:
HibernateUtil.getCurrentSession().createCriteria(PrenatalRecord.class)
    .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY)
    .setCacheable(true).list();

_________________
Code tags are your friend. Know them and use them.


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.