• Post Reply Bookmark Topic Watch Topic
  • New Topic

ejb-ql formulation question  RSS feed

 
Darryl A. J. Staflund
Ranch Hand
Posts: 314
2
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Could someone help me formulate an ejb-ql query what I can't seem to hammer down? Here is the situation.
I have three abstract schema:
a. SecurityRole
b. SecurityRoleAssignment
c. SecurityAccount
The schema stand to each other in the following relationhsips:
a. SecurityRole stands in a one-to-many bi-directional relationship with SecurityRoleAssignment. The name of the SecurityRole CMR field is 'roleAssignments'. The name of the SecurityRoleAssignment CMR field is 'role'.
b. SecurityAccount stands in a one-to-many bidirectional relationship with SecurityRoleAssignment. The name of the SecurityAccount CMR field is 'roleAssignments'. The name of the SecurityRoleAssignment CMR field is 'account'.
As you guessed, the SecurityRoleAssignment represents an assignment of a role with an account.
Selecting all accounts that have been assigned to a security role is easy. I can use the following ejb-ql query:
SELECT OBJECT (sa)
FROM SecurityAccount AS sa,
IN (sa.roleAssignments) AS ra
WHERE ra.role = ?1
But I cannot figure out how to select all accounts that are NOT a member of a specified security role. I am kind of new to ejb-ql so I am still of a SQL mindset when it comes to this. But I've tried a number of queries, all to no avail :-)
Thanks for your help everyone.
Darryl Staflund
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!