-->
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: Query using more than one class?
PostPosted: Thu Nov 23, 2006 11:17 am 
Newbie

Joined: Thu Nov 23, 2006 11:08 am
Posts: 14
hei, i just started using hibernate and i wonder, how i may create a query using more than one class? this example

Code:
List cats = session.createCriteria(Cat.class)
     .createCriteria("kittens")
         .add( Restrictions.like("name", "Iz%") )
     .list();



for example uses Cat.class, but how can i use Cat.class, Dog.class and Bird.class for example to get a list with results?

thanks in advance :-)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 23, 2006 12:36 pm 
Beginner
Beginner

Joined: Thu Oct 12, 2006 6:19 pm
Posts: 34
Location: Guatemala
Hi Morketid, I'm not sure it can be possible with Criteria Interfaz, but it is very simple if you use HQL with "select new yourNewClass(Class1.att, Class1.att2, ....)" approach.

I hope it helps

_________________
God is Love


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.