-->
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: Using collection elements in the where clause
PostPosted: Thu Apr 08, 2004 9:39 pm 
Newbie

Joined: Mon Jan 05, 2004 11:27 am
Posts: 4
Location: US
Hello,

If I have 2 classes

Code:
Owner  { Integer id ;
                Set  Pets
...
}


and  Pet  { Integer  id ;
                  String Name;
                   ....
}



Using the one-to-many collection model the Owner class has a Set of type Pet.

That all works fine.
For the life of me I can't figure out how to use Pet.Name in a hql where clause.
For example:
from Owner as o where elements(o.Pets.Name) = 'Fido'
does not work. What am I doing wrong?
Thanks in advance
.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 09, 2004 12:01 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
You want owners with a pet named fido, right?

from Owner as o join o.pets as p where p.name = ?


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.