A: 

This might help:

http://docs.jboss.org/hibernate/core/3.3/reference/en/html/querysql.html#querysql-load

I know you can do this in a mapping file; not sure how it works with annotations.

Lunivore
A: 

Assuming you have a Mentor class that has a one to many relationship with a MentorRelationship class, you would do something like this:

session.createQuery("from Mentor mentor where mentor.menteeRelationships.size < mentor.menteeRelationships.maxNumberOfRelationships")
Javid Jamae
A: 

I want to have Hibernate return all type A users that do not have all of their relationships established. I have a SQL query that will do it. What do I need to do?

Honestly, your question is still very unclear (at least for me) and without seeing the SQL, without seeing your object model and the mappings, it seems hard to be precise and my suggestion would be to either:

  • convert the SQL into HQL ~or~
  • run your query as a Native Query

If you expect a more detailed answer, you should IMO provide more details.

Pascal Thivent
I've updated my question with the query I'm trying to reproduce.
I Never Finish Anythi