Help

Controls

PermLinkWikiLink

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Forum: Seam Users Forum ListTopic List
10. Jun 2008, 09:32 CET | Link

Ok, here's the Tricky QL Question of the Day. This can be either EJB3 or Hibernate QL, because of course Hibernate is the delegate in my case.

I have a table of Tag entities. Then I have a table of Blog entities. Each Blog has a set of Tags:

@Entity public class Blog {

  private Collection<Tag> tags;
  @OneToMany public Collection<Tag> getTags() { return tags; }
// etc

If I want to get all the Blog entities which have a certain tag, that's easy:

select blog from Blog blog where :t member of blog.tags

But what if I want to find all the Blog entities which have a tag which is a member of a set? In other words, someone is using a search tool and selects search within blog entities which have tags... and he has checkboxes where he can select several tags?

Is there a way to say, union of these two sets is not empty?

Thanks