You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Steve Linabery <sl...@worldcycling.com> on 2004/01/09 16:42:10 UTC
OQL query somewhat like "not in"
Hi,
Let's say I have objects User, UserInGroup and UserGroup with attributes
as follows:
User.id (int)
User.name (String)
User.userGroups (Collection)
UserInGroup.id (int)
UserInGroup.user (User)
UserInGroup.userId (int)
UserInGroup.role (String)
UserInGroup.userGroup (UserGroup)
UserInGroup.userGroupId (int)
UserGroup.id (int)
UserGroup.shortName (String)
So we have users in groups with various roles. A User may be in
UserGroup "employee" with the roles "admin" and "member", for example.
My question is how to formulate an OQL query (or any other kind of query
for that matter) that will efficiently give me the Users that are *not*
in the group "employee" in any role.
I could, of course, just load the objects into memory and do this in
some brute force way. But then I lose the concurrency control of the
RDBMS. Or I can get a collection of User objects and then query the db
on each one, but that gets expensive for even a small set of Users.
Anyone have a solution for this? I can't imagine this is an uncommon
sort of query.
Thank you,
Steve
--
Steve Linabery, sysadmin/developer
World Cycling Productions
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org