1 Reply Latest reply on Jan 29, 2014 8:42 AM by George Gastaldi

    Forge JPA entity with custom Id type

    Manuel Rascioni Newbie

      Hi,

      Is there a way to generate an entity with a custom class as id?

       

      Like:

      /**
       * Class that define the Id
       */
      @Embeddable
      public class Code implements Serializable{
          private Integer number;
          private Integer year;
      }
      
      /**
       * My entity class
       */
      @Entity
      public class Document{
      
          @EmbeddedId
          private Code code;
      }