title: JPA QueryBuilder
body: <p>Please help to create a query!
  I have to select all Tags by categoryId via common parent object.</p>
  
  <p>I have next:</p>
  
  <pre><code>@Table(name="ADVERT")
  @Entity(name="Advert")
  public class JpaAdvert implements Advert{
  
  @Id
  @GeneratedValue
  private long id;
  
  @ManyToOne(fetch=FetchType.EAGER)
  @JoinColumn(name="category_id", referencedColumnName="id")
  private JpaCategory category = new JpaCategory();
  
  @ManyToMany(fetch=FetchType.EAGER, cascade={CascadeType.PERSIST, CascadeType.MERGE})
  @JoinTable(name="ADVERT_TAGS", joinColumns=@JoinColumn(name="advert_id",referencedColumnName="id"), inverseJoinColumns=@JoinColumn(name="tag_id", referencedColumnName="id"))
  private Set&lt;JpaTag&gt; tags = new HashSet&lt;JpaTag&gt;();
  
  ...
  </code></pre>
  
  <p>The tag object:</p>
  
  <pre><code>@Entity(name="Tag")
  @Table(name="TAG")
  public class JpaTag implements Tag {
  
  @Id
  @GeneratedValue
  private long id;
  
  private String name;
  
  private long weight=1;
  
  private String locale;
  
  ....
  </code></pre>
  
  <p>and the Category object:</p>
  
  <pre><code>@Table(name="CATEGORY")
  @Entity(name="Category")
  public class JpaCategory implements Category {
  
  @Id
  @GeneratedValue
  private long id;
  
  @Column(name="category_name")
  private String categoryName;
  
  .....
  </code></pre>
  
  <p>So I need to select ALL tags which belong to specific category by category ID. It's a bit complicated for me how to do it!</p>
  
  <p>Help please anybody!</p>