|
Hibernate version: 1.2.0 GA
Name and version of the database you are using: MS SQL 2000
I have three joined tables, say User, Event and EventThing. I'd like to run a query that joins these tables, eg.
SELECT et.thingId
FROM EventThing et
INNER JOIN Event e
ON et.eventId = e.id
INNER JOIN User u
ON e.userId = u.id
WHERE e.type = 1 and u = 12345
Is it possible to write this query inside a mapping document for the User class somehow and have the list of IDs (et.thingId) stored by NHibernate in an IList or IDictionary in that object whenever it's loaded? I know there's a "where" attribute, but it doesn't seem like I can put a join in there. I also know I can manually run an HQL query, but it would be much nicer to have this done automatically. Ie. I'd like to be able to access the "User.ThingIDs" property and have NHibernate run the query above.
|