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.  [ 1 post ] 
Author Message
 Post subject: Criteria problem - JOIN
PostPosted: Tue May 15, 2007 2:44 am 
Newbie

Joined: Mon May 14, 2007 12:00 pm
Posts: 1
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??


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.