hi there,
i have a unidirectional one-to-many relationship "events" from a class user to a class event, i.e. a user has a set of events. but events don't know about user. it's unidirectional because the OO design has a clear dependency check and the event class really doesn't need to know about the user.
now if i want to query events with user information or have constraint based on user attribute, i think i can do this:
from user u, event e where e in elements(u.events) and u.name != 'blah'
since the relationship is unidirectional, i cannot do a more natural one like this: (if there were a bidirectional relationship from event to user as well)
from user u, event e where e.user = u and u.name != 'blah'
my question is the first query looks more expensive than the 2nd one because it's doing a "in", is that right? is there anyway to do something like the 2nd query while keeping the unidirectional relationship? (because i really hate to change the object model just for the sake of better query performance.)
thanks in advance.
|