I'm not sure how to describe this problem, so I think an example is the best way to ask my question:
I have two tables with a manyToMany relationship:
DriversLicence <-> LicenceClass
LicenceClass is things like "Car", "Motorbike", and "Medium Rigid".
Using Hibernate Criteria, how can I find all licences that have both "Car" and "Motorbike" LicenceClasses?
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?"