1 Reply Latest reply on Feb 24, 2004 1:11 PM by Viet

    Composite Primary Key

    Dennis Przybyla Novice

      How do I create a XDoclet tag that will generate the code for a table with a composite primary key?

      Thanks,
      Dennis Przybyla

        • 1. Re: Composite Primary Key
          Viet Master

          you need to tag the persistent fields that will be part of the PK :

          /**
           * ...
           * @ejb.pk
           * extends="java.lang.Object"
           * ...
           */
          public class MyEJB ...
          
          ...
          
           /**
           * @ejb.interface-method
           * @ejb.persistence
           * column-name="topic_id"
           * @ejb.pk-field
           */
           public abstract Integer getTopicId();
          
           /**
           * @ejb.interface-method
           * @ejb.persistence
           * column-name="user_id"
           * @ejb.pk-field
           */
           public abstract Integer getUserId();
          
          ...
          
          }