[jboss-user] [EJB 3.0] - GeneratedValue within Embedded Id

hitman_in_wis do-not-reply at jboss.com
Mon Sep 18 13:11:52 EDT 2006


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!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3972375#3972375

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3972375



More information about the jboss-user mailing list