Restrict the class of an association in a Hibernate Criteria query

Posted by D Lawson on Stack Overflow See other posts from Stack Overflow or by D Lawson
Published on 2010-06-17T13:46:01Z Indexed on 2010/06/17 14:03 UTC
Read the original article Hit count: 176

Filed under:
|
|

I have an object, 'Response' that has a property called 'submitter'. Submitters can be one of several different classes including Student, Teacher, etc...

I would like to be able to execute a criteria query where I select only responses submitted by teachers - so this means putting a class restriction on an associated entity. Any ideas on this? I'd like to stay away from direct SQL or HQL.

© Stack Overflow or respective owner

Related posts about java

Related posts about hibernate