Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
3.0
Name and version of the database you are using:
Oracle 8.1.7
Question
Hi there. Apologies for asking a simple question in the forum, but I've tried RTFM'ing and searching the forum and I can't find an explanation to the very basic question below.
I have three tables representing a many to many relationship between an Employee and that employee's current roles in the application.
EMPLOYEE, EMPLOYEE_ROLE, ROLE
I believe I have all of my mapping files correctly set up [if not I can debug on my own]. However, I have no idea how to write a Hibernate query with a condition on the other side of a many to many relationship.
Logically, I want to query for all employees with a particular role
In SQL I would normally write would be something like:
SELECT EMPLOYEE.ID FROM EMPLOYEE E, EMPLOYEE_ROLE ER, ROLE R
WHERE
E.ID = ER.EMPLOYEEID
AND
ER.ROLEID = R.ID
WHERE R.NAME = "Administrator"
How do I do this in Hibernate?
[please feel free to just point me to the documentation or similar posts on the forum]
Thanks in advance,
-Tim