2 Replies Latest reply on Jan 7, 2008 10:11 AM by jBossTester jBossTester

    EmbeddedId and GeneratedValue

    J-C jc Apprentice

      I'd like to use an embeddedID for some of my classes. Th class PK is an embeddable, it contains one field:

      private long id;


      I'd like to generate the value, I've try:
      @Id
       @GeneratedValue(strategy = GenerationType.TABLE)
       @Column(name="CUST_ID")
       private long id;


      In that case annotaions are not used (PK is not generated).

      Any idea how to have a generatedValue for a PK in a embeddedID ?

      PS: I'd like to use an embedded ID for typing the PK. I do not like to see long everywhere in the application. It may be bug prone.