Created
June 17, 2011 03:42
-
-
Save mpurbo/1030830 to your computer and use it in GitHub Desktop.
Hibernate many-to-many Criterion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Criteria criteria = session.createCriteria(Programmer.class); | |
criteria.add(Restrictions.sqlRestriction( | |
"EXISTS(" + | |
"SELECT pp.programmer_id " + | |
"FROM programmers_projects pp " + | |
"WHERE " + | |
"pp.programmer_id = {alias}.programmer_id AND " + | |
"pp.project_id IN (1, 2) )" | |
)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment