There are 3 tables: User, Application, and User2Application.
User2Application is a bridge table and contains an Application object, and User object.
I am trying to retrieve all users who have access to the given application. The HQL query above works fine, however I need to add orderBy and rowCount, and I think using Criteria would be better choice.
SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
Because you need to look at one class but return another, I think you'd need to do something like this...
What this does is create a criteria on User2Application saying that the query should find all User2Applications that have the given application. From this set of matches, then return the users found.
For more information you can look at Hibernate tutorial - criteria queries (specifically 15.4) that gives more information on this and how you would expand it to include order by. By that I mean where to put the order by so that the criteria make sense.
Hope that helps, Rachel [ September 02, 2008: Message edited by: Rachel Swailes ]