I am creating Ids for the primary key in a table using  annotations in the EJB.

 

@Entity

@Table(name = "MY_TABLE")

@SequenceGenerator(name = "MY_SEQ", sequenceName = "MY_SEQ")

 

@Id

@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "MY_SEQ")

@Column(name = "ID")

 

I noticed that the values inserted in the table are much bigger than the ones currently in MY_SEQ.NEXTVAL. I get that I can play with the "allocation size" property, and I must restart all my database sequences so they can "reach" the max values in each table, but can I be sure that the value created by the entity bean is in sync with the database sequence?

 

Thanks for any help

FacebookTwitterLinkedin
Pin It
Joomla Tutorials for Beginners