• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

intersection between two collections

 
J. Cartwright
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I have a class "Content" where each instance contains a collection of Keywords. I'd like to create a query where I pass a set of Keywords and find all Content instances where any one of Keywords is referenced.

The following query seems to work for a single Keyword:

query="from Content as content where :keyword in elements(content.keywords)"),

However I can't seem to figure out how to apply a list of Keywords to it. This is how I would expect to do it via SQL:

# find content records that contain keywords 151 or 157
select distinct a.id from content a, content_keyword b, keyword c where a.id = b.content_id and b.keyword_id = c.id and c.id in (151,157);

Can anyone please help me here?

Thanks!

--john
[ November 09, 2008: Message edited by: J. Cartwright ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic