0 Replies Latest reply on Nov 18, 2002 10:38 AM by Manish Shah

    sleepless nights and null CMR's..help

    Manish Shah Newbie

      hi everyone,
      i have scoured the list for the last two days.....and thought i was close to setting a 1:m CMR but now i am stuck.....


      the cmr field is never populated and seems that ejbPostCreate doesnt get called. could someone please help me here....

      and also what is the diff betn the use of @jboss:relation and @jboss:target-relation...


      ******************BundleEJB*********************************************
      **
      * @ejb:interface-method view-type="both"
      */
      public abstract void setProjectID(Integer projectID);

      /**
      * @ejb.interface-method
      * view-type="local"
      *
      *

      *
      * @ejb:relation name="bundle-properties"
      * role-name="bundle-has-properties"
      * target-ejb="PropertyEJB"
      *
      * @jboss:target-relation fk-constraint="true"
      * related-pk-field="entityID"
      * fk-column="bundle_id_fk"
      */
      public abstract java.util.Collection getPropertiesInBundle();

      /**
      *
      * @ejb:interface-method view-type="both"
      */
      public abstract void setPropertiesInBundle(Collection

      propertiesInBundle);

      **********************PropertyEJB**************************************
      /**
      * @ejb:interface-method view-type="both"
      *
      *
      *
      * @ejb:relation name="bundle-properties"
      * role-name="properties-belongto-bundle"
      * target-ejb="BundleEJB"
      * target-multiple="yes"
      *
      * @jboss:relation fk-constraint="true"
      * related-pk-field="entityID"
      * fk-column="bundle_id_fk"
      *
      *
      */

      public abstract BundleEJBLocal getBundle();

      /**
      * @ejb:interface-method view-type="both"
      *
      */
      public abstract void setBundle(BundleEJBLocal bundleLocal);






      /**
      * Create Method
      * @ejb:create-method
      * @ejb:transaction type="Required"
      */

      public PropertyEJBPK ejbCreate(String propertyKey,String

      propertyValue,Integer projectID, BundleEJBLocal bundleLocal)
      throws CreateException
      {
      System.out.println("creating

      PropretyEJB"+bundleLocal.getPrimaryKey());
      setPropertyKeyName(propertyKey);
      setPropertyKeyValue(propertyValue);
      setProjectID(projectID);
      return null;
      }

      /**
      * Create method
      *
      *
      *
      *
      */

      public void ejbPostCreate(String propertyKey,String

      propertyValue,Integer projectID, BundleEJBLocal bundleLocal)
      throws CreateException
      {
      System.out.println("PropertyEJB-postcreate bundleID=");
      setBundle(bundleLocal);
      }


      **************************ejb-jar****************************************

      <!-- Relationships -->

      <ejb-relation >
      <ejb-relation-name>bundle-properties</ejb-relation-name>

      <ejb-relationship-role >


      <ejb-relationship-role-name>properties-belongto-bundle</ejb-relationship-r

      ole-name>
      Many
      <relationship-role-source >
      <ejb-name>PropertyEJB</ejb-name>
      </relationship-role-source>
      <cmr-field >
      <cmr-field-name>bundle</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>

      <ejb-relationship-role >


      <ejb-relationship-role-name>bundle-has-properties</ejb-relationship-role-n

      ame>
      One
      <relationship-role-source >
      <ejb-name>BundleEJB</ejb-name>
      </relationship-role-source>
      <cmr-field >
      <cmr-field-name>propertiesInBundle</cmr-field-name>
      <cmr-field-type>java.util.Collection</cmr-field-type>
      </cmr-field>
      </ejb-relationship-role>

      </ejb-relation>


      ********************************jbosscmp-jdbc****************************

      <ejb-relation>
      <ejb-relation-name>bundle-properties</ejb-relation-name>

      <foreign-key-mapping/>

      <ejb-relationship-role>


      <ejb-relationship-role-name>properties-belongto-bundle</ejb-relationship-r

      ole-name>
      <fk-constraint>true</fk-constraint>
      <key-fields/>
      </ejb-relationship-role>
      <ejb-relationship-role>


      <ejb-relationship-role-name>bundle-has-properties</ejb-relationship-role-n

      ame>
      <key-fields>
      <key-field>
      <field-name>entityID</field-name>
      <column-name>bundle_id_fk</column-name>
      </key-field>
      </key-fields>
      </ejb-relationship-role>
      </ejb-relation>