0 Replies Latest reply on Sep 18, 2006 1:11 PM by Brett Birschbach

    GeneratedValue within Embedded Id

    Brett Birschbach Newbie

      My company has a table that has a primary key of 5 columns, one of which is an auto-generated sequence. This was not always an auto-generated sequence, and previously was only unique for any combination of the first 4 columns, not unique for the entire table. Therefore, the primary key of the table cannot be simply changed to this one sequence column. However, the column is part of the primary key, and it is unique for any rows forward.

      My entity based on this table has an embedded id which encompases the five columns, one of which is the sequence column. Is it possible for me to use a sequence generator to generate the value for this column within the embedded id?

      Ive tried putting the necessary sequence annotations in the embedded object, but they are ignored. I dont believe there is any place to put the sequence annotations within the AttributeOverrides of the entity object. Therefore, I'm guessing the only way to populate the column will be for me to manually retrieve the next sequence from the database and set it myself. Is this correct?

      Thanks!