0 Replies Latest reply on Aug 5, 2003 12:31 PM by droed

    Foreign key target in same bean, w/ PK class

    droed Newbie

      Does anyone have info on specifying parent-child foreign keys, where both belong to the same CMP bean?
      Also, where a primary key class is being generated and used?

      I'm getting RuntimeException; CausedByException is: null

      I'm using XDoclet to generate the interfaces, primary key class, and deployment descriptors.

      /**
      * Primary key of this Theme.
      *
      * @ejb.pk-field
      * @ejb.persistent-field
      * @ejb.interface-method
      *
      * @ejb.persistence column-name="theme_id"
      *
      */
      public abstract long getId();

      /**
      *
      * @ejb.interface-method
      *
      * @ejb.transaction type="Supports"
      * @ejb.persistent-field
      * @ejb.persistence column-name="parent_id"
      *
      * @ejb.relation
      * name="ThemeParentAssociation"
      * role-name="Theme-has-parent"
      * target-ejb="Theme"
      *
      * @jboss.relation
      * fk-column="parent_id"
      * related-pk-field="id"
      *
      * @jboss.persistence not-null="false"
      */
      public abstract long getParentId();

      I don't have any relationship tags on the primary key class, I don't they are necessary in this case if it's a one-way relationship. When I tried putting relationship tags for the primary key JBoss had problems on startup.