-->
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: DetatchedCriteria without on clause
PostPosted: Fri Aug 23, 2013 3:54 am 
Newbie

Joined: Fri Aug 23, 2013 3:06 am
Posts: 1
Hi All!

I'm relatively new to Hibernate. I have to use the 3.2 version and i need to use DetachedCriteria and obtain the following query:

select this_.ID as ID0_1_, this_.SNDG as SNDG0_1_, this_.NDG as NDG0_1_, this_.T_GWR_PARTNER_ID as T4_0_1_, table2x1_.ID as ID1_0_, table2x1_.T_GWR_PROPOSAL_ID as T2_1_0_, table2x1_.GROUP_SNDG as GROUP3_1_0_, table2x1_.GROUP_NAME as GROUP4_1_0_ from t_gwr_proposals this_ inner join t_gwr_proposal_ratings table2x1_ where table2x1_.T_GWR_PROPOSAL_ID=this_.ID

but I obtain the follwing

select this_.ID as ID0_1_, this_.SNDG as SNDG0_1_, this_.NDG as NDG0_1_, this_.T_GWR_PARTNER_ID as T4_0_1_, table2x1_.ID as ID1_0_, table2x1_.T_GWR_PROPOSAL_ID as T2_1_0_, table2x1_.GROUP_SNDG as GROUP3_1_0_, table2x1_.GROUP_NAME as GROUP4_1_0_ from t_gwr_proposals this_ inner join t_gwr_proposal_ratings table2x1_ on this_.ID=table2x1_.ID where table2x1_.T_GWR_PROPOSAL_ID=this_.ID

using this code:

Criteria c = session.createCriteria(T_gwr_proposals.class, "Table1");
c.createAlias("Table1.T_gwr_proposal_ratings", "Table2"); // inner join by default
c.add(Restrictions.eqProperty("Table2.t_gwr_proposal_id", "Table1.proposalsId"));
return c.list();

Can anyone help me, please?

Thank you very much,

Tommaso A.


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.