Hi,

I'm trying to get m:n bidirectional relationships to work, and I'm a bit
stuck so far.
I've 2 EJB beans: Role and Subject linked together by table actor. (Actor
does not have an associated entitybean) All the tables are there in the
database And querying on them works fine by using the generated EJB's.
However when I do a call in a SessionBean (after retrieveing the
SubjectLocal and RoleLocal) to either SubjectLocal.getRoles() or
RoleLocal.getSubjects() nothing returns. And even worse JBoss doesnot
generate error messages.
I've also tried SubjectLocal.setRoles(set) and RoleLocal.setSubjects(set)
which again does not generate any error messages nor an extra column in
the db-table actor.
What can I do to switch on debugging, or can anybody have a quick look on
what's going wrong with the sources provided below.

kind regards and thnx in advance
Jeroen D

Role:
        /* CMR */
        /**
         * @ejb.interface-method
         *      view-type = "both"
         * @ejb.relation
         *      name = "role-subject"
         *  role-name = "roleToSubject"
         * @jboss.relation-table
         *      table-name="actor"
         * @jboss.relation
         *      fk-column = "subjectid"
         *  related-pk-field = "subjectId"
         * @jboss.relation-mapping
         *      style = "relation-table"
         * @param subjectCollection
         */
        public abstract java.util.Set getSubjects();

        /**
         * @ejb.interface-method
         *      view-type="local"
         *
         * @param subjectCollection java.util.Set
         */
        public abstract void setSubjects(java.util.Set subjectCollection);

SubjectBean:
        /**
         * @ejb.interface-method
         *      view-type = "both"
         * @ejb.relation
         *      name = "role-subject"
         *  role-name = "SubjectToRole"
         * @jboss.relation-table
         *      table-name="actor"
         * @jboss.relation
         *      fk-column = "roleid"
         *  related-pk-field = "roleId"
         * @jboss.relation-mapping
         *      style = "relation-table"
         * @param subjectCollection
         */
        public abstract java.util.Set getRoles();

        /**
         * @ejb.interface-method
         *      view-type = "both"
         * @param roleCollection
         */
        public abstract void setRoles(java.util.Set roleCollection);

ejb-jar.xml:
   <relationships >
      <ejb-relation >
         <ejb-relation-name>role-subject</ejb-relation-name>

         <ejb-relationship-role >
 <ejb-relationship-role-name>roleToSubject</ejb-relationship-role-name>
            <multiplicity>Many</multiplicity>
            <relationship-role-source >
               <ejb-name>Role</ejb-name>
            </relationship-role-source>
            <cmr-field >
               <cmr-field-name>subjects</cmr-field-name>
               <cmr-field-type>java.util.Set</cmr-field-type>
            </cmr-field>
         </ejb-relationship-role>

         <ejb-relationship-role >
   <ejb-relationship-role-name>SubjectToRole</ejb-relationship-role-name>
            <multiplicity>Many</multiplicity>
            <relationship-role-source >
               <ejb-name>Subject</ejb-name>
            </relationship-role-source>
            <cmr-field >
               <cmr-field-name>roles</cmr-field-name>
               <cmr-field-type>java.util.Set</cmr-field-type>
            </cmr-field>
         </ejb-relationship-role>

      </ejb-relation>
   </relationships>


jbosscmp-jdbc.xml:
    <ejb-relation>
      <ejb-relation-name>role-subject</ejb-relation-name>
      <relation-table-mapping>
        <table-name>actor</table-name>
      </relation-table-mapping>

      <ejb-relationship-role>
 <ejb-relationship-role-name>roleToSubject</ejb-relationship-role-name>
          <key-fields>
             <key-field>
               <field-name>roleId</field-name>
               <column-name>roleid</column-name>
             </key-field>
          </key-fields>

      </ejb-relationship-role>
      <ejb-relationship-role>
 <ejb-relationship-role-name>SubjectToRole</ejb-relationship-role-name>
          <key-fields>
             <key-field>
               <field-name>subjectId</field-name>
               <column-name>subjectid</column-name>
             </key-field>
          </key-fields>

      </ejb-relationship-role>
    </ejb-relation>







-------------------------------------------------------
This SF.net email sponsored by: Enterprise Linux Forum Conference & Expo
The Event For Linux Datacenter Solutions & Strategies in The Enterprise 
Linux in the Boardroom; in the Front Office; & in the Server Room 
http://www.enterpriselinuxforum.com
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to