Hi,
I need to add a unidirectional m:n relationship between 2 E.Beans. Can any one help me please..
I tried with the following stuff
User and Role Beans are there with the following fields.
User : userId , password
Role : name , description
I need to add roles to users but not viceversa..
Code snippet for UserBean
--------------------------
/**
* @ejb.interface-method
* view-type="local"
*
*@ejb:relation
* name="UserAssociatedWithRoles"
* role-name="UserBeanToRoleBean"
* cascade-delete="no"
* target-ejb="Role"
* target-multiple="yes"
* target-role-name="UsersHaveRoles"
*
* @jboss.relation-table
* table-name="USER_ROLE"
* create-table="yes"
* @jboss:relation
* fk-constraint="false"
* related-pk-field="userId"
* fk-column="NAME"
**/
public abstract Collection getRoles();
--------------
It gives me an error message ---
<
But Im using jboss
--------------
Can any one help with this..
Thanks in advance
-
Unidirectional M:N relationship with xDoclet ??? (1 messages)
- Posted by: B P
- Posted on: April 21 2004 00:25 EDT
Threaded Messages (1)
- Here's what we got... by Web Master on April 21 2004 03:49 EDT
-
Here's what we got...[ Go to top ]
- Posted by: Web Master
- Posted on: April 21 2004 03:49 EDT
- in response to B P
/**
* @ejb.interface-method
* @ejb.relation
* name="UserRole"
* role-name="UserHasRoles"
* target-ejb="Role"
* target-role-name="RoleBelongUsers"
*
* @jboss.relation-table
* table-name="ROLE_FOR_USER"
*
* @jboss.target-relation
* fk-constraint="yes"
* related-pk-field="id"
* fk-column="USER_ID"
* @jboss.relation
* fk-constraint="yes"
* related-pk-field="id"
* fk-column="ROLE_ID"
*/
public abstract Collection getRoles();
The ROLE_FOR_USER is a relation table where one field is USER_ID the other is ROLE_ID. This code works with JBoss 3.2.2, 3.2.3