Hi Emmanuel,
Thanks for your answer. This is how it looks:
First, the Principal - Group m-m ralationship where the principal is a member
of the group
The Group persistence bean
@ManyToMany( cascade = {CascadeType.PERSIST, CascadeType.MERGE},
| fetch = FetchType.EAGER)
| @JoinTable(
| [EMAIL PROTECTED](name="PRINCIPAL_GROUP"),
| [EMAIL PROTECTED](name="GROUP_ID")},
| [EMAIL PROTECTED](name="PRINCIPAL_ID")}
| )
| public Set<Principal> getMembers() {
| return members;
| }
Now the Principal persistence bean
@ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE},
| fetch = FetchType.EAGER,
| mappedBy="members")
| public Set<Group> getGroups() {
| return groups;
| }
Now the Principal - Group m-m relationship where any number of principals own
any number of groups
This is the Principal persistence Bean
@ManyToMany( cascade = {CascadeType.PERSIST, CascadeType.MERGE},
| fetch = FetchType.EAGER)
| @JoinTable(
| [EMAIL PROTECTED](name="PRINCIPAL_OWNED"),
| [EMAIL PROTECTED](name="PRINCIPAL_ID")},
| [EMAIL PROTECTED](name="GROUP_ID")}
| )
| public Set<Group> getSerfs() {
| return serfs;
| }
On the Group side
@ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE},
| fetch = FetchType.EAGER,
| mappedBy="serfs")
| public Set<Principal> getOwners() {
| return owners;
| }
I've also tried to have both relationship table definitions in one persistence
bean.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3923797#3923797
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3923797
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user