-->
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: Criteria Restriction on JOIN clause instead on WHERE clause
PostPosted: Wed Mar 02, 2011 3:23 am 
Newbie

Joined: Sat Feb 12, 2011 6:26 am
Posts: 2
Hi,

Is there any way to create a hibernate Criteria with Restriction on JOIN clause instead on WHERE clause.

I want following query:
SELECT * from company c join company_type ct ON c.company_type=ct.id and ct.active=true
instead of
SELECT * from company c join company_type ct ON c.company_type=ct.id where ct.active=true

Currently I am creating Criteria as follows:

Code:
Criteria mainCriteria = getSession().createCriteria(Company.class)
                    .createCriteria("companyType", CriteriaSpecification.LEFT_JOIN).add(Restrictions.eq("active", true));


rizzz86


Top
 Profile  
 
 Post subject: Re: Criteria Restriction on JOIN clause instead on WHERE clause
PostPosted: Wed Mar 02, 2011 8:57 am 
Regular
Regular

Joined: Fri Jan 28, 2011 11:44 am
Posts: 117
Hi,

Before Hibernate 3.5.0, its impossible:

http://opensource.atlassian.com/project ... e/HHH-2308


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.