-
1. Re: XDoclet tags for many-to-many relationships
aloubyansky Mar 7, 2002 2:34 AM (in response to scoy)It seems like there isn't for now. I do it manually too.
-
2. Re: XDoclet tags for many-to-many relationships
scoy Mar 12, 2002 10:46 PM (in response to scoy)It looks like we don't need this if all the jboss relationship tags are set up properly, unless you really want to specify a table name.
JBoss manages to derive a reasonable table name for itself. -
3. Re: XDoclet tags for many-to-many relationships
alexcyn Mar 23, 2002 10:55 AM (in response to scoy)Yes, I just have found how to do this:
ProductEntityBean CMR field:
/**
* @ejb:relation name="name1"
* role-name="role1" multiple="yes"
* @jboss:relation-table
* table-name="product_category"
* @jboss:relation
* related-pk-field="id" fk-column="category_id"
*/
public abstract Collection getCategories();
CategoryEntityBean CMR field:
/**
* @ejb:relation name="name1"
* role-name="role2" multiple="yes"
* @jboss:relation-table
* table-name="product_category"
* @jboss:relation
* related-pk-field="id" fk-column="product_id"
*/
public abstract Collection getProducts(); -
4. Re: XDoclet tags for many-to-many relationships
java Oct 2, 2002 8:08 PM (in response to scoy)just thought i could add the unidirectional many to many code: (i am using xdoclet 1.12)
in the rolebean:
/**
* @ejb:interface-method view-type="both"
*/
public abstract Collection getUsers();
/**
* @ejb:interface-method view-type="both"
*/
public abstract void setUsers(Collection users);
in the userbean:
/**
* @ejb:interface-method view-type="both"
* @ejb:relation
* name="User-Roles"
* role-name="User-has-many-Roles"
* target-ejb="Role"
* target-role-name="Role-has-many-Users"
* target-multiple="yes"
* @jboss:relation fk-constraint="false" related-pk-field="id" fk-column="ROLE_ID"
* @jboss:target-relation fk-constraint="false" related-pk-field="id" fk-column="USER_ID"
*/
public abstract Collection getRoles();
/**
* @ejb:interface-method view-type="both"
*/
public abstract void setRoles(Collection roles);