title: Querying ManyToMany relationship with Hibernate Criteria
body: <p>I'm not sure how to describe this problem, so I think an example is the best way to ask my question:</p>
  
  <p>I have two tables with a manyToMany relationship:</p>
  
  <p>DriversLicence &lt;-> LicenceClass</p>
  
  <p>LicenceClass is things like "Car", "Motorbike", and "Medium Rigid".</p>
  
  <p>Using Hibernate Criteria, how can I find all licences that have both "Car" and "Motorbike" LicenceClasses?</p>
  
  <p>UPDATE 12/11/2008
  I have discovered that this can easily be achieved by using a custom ResultTransformer. However the problem is that a result transformer only gets applied AFTER the query returns its results, it does not actually become part of the SQL. So I guess my question is now "Can you do what I initially described in SQL - and is there a Hibernate Criteria analog?"</p>