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

    Composite Primary Key

      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

          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();
          
          ...
          
          }