-->
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.  [ 1 post ] 
Author Message
 Post subject: HQL Query with collection as filter
PostPosted: Mon May 26, 2008 5:31 am 
Newbie

Joined: Tue Apr 29, 2008 3:02 am
Posts: 5
Hibernate version: 3.2.6.

Mapping documents: none (Annotations)

Name and version of the database you are using: MySQL 5.0


I'm kindof stuck building a correct HQL query.
I have 2 classes in a many-to-many relationship.

class Sheet
class Tag

One sheet can have several tags and one tag can be used for several sheets.
Is there a possibility for a HQL query that selects all sheets with a certain collection of tags?

Something like:

FROM Sheet s
WHERE s.tags = (from Tag t where t.id = 1 or t.id = 2)

So select all sheets where the tag collection equals a collection of tags where the tag id is 1 or 2.

Thx already

_________________
Rechtschreibfehler sind beabsichtigt und dienen der allgemeinen Erheiterung.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.