-->
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 over multiple class objects?
PostPosted: Tue May 24, 2005 2:46 am 
Newbie

Joined: Mon Mar 14, 2005 3:11 am
Posts: 1
Hi..

i am new to hibernate and have been reading the documentation for the Criteria query for quite some time now.. just wan to clear my doubts here..

is it possible for hibernate Criteria class to be able to span over multiple class objects? For eg, an sql statement such as this :

select a.sailorName, b.boatName
from sailor a, reserves b
where a.sid = b.rid

can it be converted to implement the criteria Class of hibernate? thanks.

ck


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 24, 2005 10:23 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Use Query.

Query query = session.createQuery(<your hql>);
List list = query.list();

Elements are in list are of type Object[].


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 24, 2005 12:44 pm 
Expert
Expert

Joined: Sat Jan 17, 2004 2:57 pm
Posts: 329
Location: In the basement in my underwear
You should be able to do that with Projections shouldn't you? (as long as there is an association between your 2 tables)


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.