Hibernate version: 3.2.6
Mapping:
parent entity:
Code:
<class="parent" class="Parent">
<many-to-one name="child3" class="child3" fetch="select">
<column name="PFILE_DIRECT_FILE" />
</many-to-one>
.....
<set name="child1s" inverse="true">
<key>
<column name="PAMSG_MESSAGE_ID" not-null="true" />
</key>
<one-to-many class="Child1" />
</set>
<set name="child2s" inverse="true">
<key>
<column name="PAMSG_MESSAGE_ID" not-null="true" />
</key>
<one-to-many class="Child2" />
</set>
.....
</class>
Query:
Integer fileId = 1; //parameter in dao
ScrollableResults scrollableResults = session.createCriteria( Tpwpamsg.class )
.add( Restrictions.eq( "child3.pfileFileId", fileId ) )
.setResultTransformer( CriteriaSpecification.DISTINCT_ROOT_ENTITY )
.setFetchMode( "child1s", FetchMode.JOIN )
.setFetchMode( "childe2s", FetchMode.JOIN )
.scroll( ScrollMode.FORWARD_ONLY );
return scrollableResults;
I expected this to return a disctinct scrollable result of parent entities, but they are in fact duplicated!? Why so?
Code: