E
Eric Ford
We've been troubling for some time now with implementing a many-to-many
relation using CMP. We are using JBoss 3.0.8, Eclipse and XDoclet.
So, we have the following two tables:
User 1 -------- * Friend * ---------- 1 User
A User can have many Friends, and a Friend is also a user. Our main
objective is this: We are looking to find all Friends that belong to a
certain User. For each of these Friends, we need to be able to trace back to
User, so as we can retrive the User data for this Friend.
The two beans corresponding to these tables are UserBean and FriendBean.
We've set up the following in UserBean (excerpt):
* @ejb.interface-method
* @ejb.relation name = "ChatUser-Friend"
* role-name = "ChatUser-can-have-many-friends"
* target-ejb = "Friend"
*/
public abstract Collection getFriends();
/**
* @ejb.interface-method
*/
public abstract void setFriends(Collection friends);
relation using CMP. We are using JBoss 3.0.8, Eclipse and XDoclet.
So, we have the following two tables:
User 1 -------- * Friend * ---------- 1 User
A User can have many Friends, and a Friend is also a user. Our main
objective is this: We are looking to find all Friends that belong to a
certain User. For each of these Friends, we need to be able to trace back to
User, so as we can retrive the User data for this Friend.
The two beans corresponding to these tables are UserBean and FriendBean.
We've set up the following in UserBean (excerpt):
* @ejb.interface-method
* @ejb.relation name = "ChatUser-Friend"
* role-name = "ChatUser-can-have-many-friends"
* target-ejb = "Friend"
*/
public abstract Collection getFriends();
/**
* @ejb.interface-method
*/
public abstract void setFriends(Collection friends);