Hi,
I have problem with Criteria joins.
With following code >>
Criteria selectCriteria = session.createCriteria(Flat.class);
Criteria crit = selectCriteria.createCriteria("OutputDefinition", "od");
crit.add(Restrictions.eq( "od.Checked" , "Y" ));
selectCriteria.setMaxResults(100);
selectCriteria.setFirstResult(pagingFrom);
result = selectCriteria.list();
I got following SQL >>
select
this_.NAME as FS1_7_0_,
this_.GEN as GEN7_0_,
this_.INC as INC3_7_0_,
from
T540 this_
where
od1_.IS_CHECKED=? fetch first 100 rows only
instead of query with inner join to table T530
HBM.XMLs
T540 >>
<class name="Flat" table="T540">
<composite-id>
<key-many-to-one name="OutputDefinition" class="FlatDef">
<column name="NAME" length="32" not-null="true"/>
<column name="GEN" not-null="true"/>
</key-many-to-one>
<key-property name="IncrNumber" type="int">
<column name="INC" />
</key-property>
</composite-id>
<property name="Update" type="int">
<column name="UPDATE" not-null="true">
</column>
</property>
</class>
T530 >>
<class name="FlatDef" table="T530">
<composite-id>
<key-many-to-one name="FlatStructure" class="FlatStr">
<column name="NAME" length="32"/>
</key-many-to-one>
<key-property name="Generation" type="int">
<column name="GEN" />
</key-property>
</composite-id>
</class>
Hib version 3.2.1
Can you tell me what is wrong??
|