-->
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.  [ 3 posts ] 
Author Message
 Post subject: Criteria Query Inner Joins
PostPosted: Sun Jan 16, 2005 6:54 pm 
Newbie

Joined: Thu Nov 25, 2004 11:44 am
Posts: 15
Location: Woodbridge UK
Can anyone tell me how one does inner joins using Query by Criteria

My HQL is:
"from Manufacturer manufacturer join fetch manufacturer.contact contact"

which produces SQL like
select ... from MANUFACTURER inner join CONTACT on MANUFACTURER.CONTACT_ID=CONTACT.id

I can simulate the result by doing an eager fetch

Criteria criteria = session.createCriteria(Manufacturer.class);
criteria.setFetchMode("contact", FetchMode.EAGER);
criteria.add(Expression.isNotNull("contact"));

select ... fields from the tables CONTACT and MANUFACTURER ... from MANUFACTURER this left outer join CONTACT on MANUFACTURER.CONTACT_ID=CONTACT.id where MANUFACTURER.CONTACT_ID is not null

Is there a simple way to get the SQL to produce the inner join syntax

Phil Zoio


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 16, 2005 7:05 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
criteria.createCriteria()


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 17, 2005 12:40 pm 
Newbie

Joined: Thu Nov 25, 2004 11:44 am
Posts: 15
Location: Woodbridge UK
Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.