2 Replies Latest reply on Feb 11, 2002 7:26 PM by Fred Loney

    Is self-reference CMR supported?

    Fred Loney Newbie

      An entity with a CMR to itself yields a NPE (trace below).
      Is this is a known restriction, or is it an app config problem?

      The self-reference is of the form:

      <ejb-relation-name>Category-Category</ejb-relation-name>
      <ejb-relationship-role>
      <ejb-relationship-role-name>Category-has-SuperCategory</ejb-relationship-role-name>
      Many
      <relationship-role-source>
      <ejb-name>Category</ejb-name>
      </relationship-role-source>
      <cmr-field>
      <cmr-field-name>superCategory</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>Category-has-SubCategories</ejb-relationship-role-name>
      One
      <relationship-role-source>
      <ejb-name>Category</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>
      </ejb-relation>

      [ContainerFactory,ERROR] java.lang.NullPointerException
      [ContainerFactory,ERROR] at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.execute(JDBCStartCommand.java:46)
      [ContainerFactory,ERROR] at org.jboss.ejb.plugins.cmp.CMPStoreManager.start(CMPStoreManager.java:142)
      [ContainerFactory,ERROR] at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:92)
      [ContainerFactory,ERROR] at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:169)
      ...

        • 1. Re: Is self-reference CMR supported?
          Christopher Jozsa Newbie

          I've made the same on yesterday, and yes, it seems like working. I've configured it with XDoclet, and the generated descriptor looks like this:

          <ejb-relation>
          <ejb-relation-name>Category-Categories</ejb-relation-name>
          <ejb-relationship-role>
          <ejb-relationship-role-name>category-has-parentcategory</ejb-relati
          Many
          <relationship-role-source>
          <ejb-name>Category</ejb-name>
          </relationship-role-source>
          <cmr-field>
          <cmr-field-name>parentCategory</cmr-field-name>
          </cmr-field>
          </ejb-relationship-role>
          <ejb-relationship-role>
          <ejb-relationship-role-name>parentcategory-has-categories</ejb-rela
          One
          <relationship-role-source>
          <ejb-name>Category</ejb-name>
          </relationship-role-source>
          <cmr-field>
          <cmr-field-name>categories</cmr-field-name>
          <cmr-field-type>java.util.Collection</cmr-field-type>
          </cmr-field>
          </ejb-relationship-role>

          hth,
          Christopher

          • 2. Re: Is self-reference CMR supported?
            Fred Loney Newbie

            Thanks for the prompt response. I was using a pre-alpha JBoss 3.0 CVS build. I update to alpha and it now works.