Hi,

I set up a m-n bi-directional CMR relationship with XDoclet (with some little help 
from http://www.jboss.org/index.html?module=bb&op=viewtopic&t=41050). 


So, my UserEntityBean looks like: 

    /**
     * @ejb.interface-method
     *
     * @ejb.relation
     *   name = "user-role"
     *   role-name = "user-has-roles"
     *
     * @jboss.relation-table
     *   table-name="UserRoleRelation"
     *
     * @jboss.relation
     *   fk-column = "fk_rolename"
     *   related-pk-field = "rolename"
     *
     * @jboss.relation-mapping
     *   style = "relation-table"
     */
    public abstract Collection getRoles();
    public abstract void setRoles(Collection roles);



and my RoleEntityBean looks like:
    /**
     * @ejb.interface-method
     *
     * @ejb.relation
     *   name="user-role"
     *   role-name="role-has-users"
     *
     * @jboss.relation-table
     *   table-name="UserRoleRelation"
     *
     * @jboss.relation
     *   fk-column="fk_username"
     *   related-pk-field="username"
     *
     * @jboss.relation-mapping
     *   style="relation-table"
     */
    public abstract Collection getUsers();
    public abstract void setUsers(Collection users);



I think it is working... ok, at least JBoss does not complain while deploying.

But how do I actually add a Role to a User? And how do I again remove it? 
Can someone provide me with some kind of code example?




View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3841527#3841527

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3841527


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to