Thursday, January 26, 2006

@GeneratedValue limitations

When I saw that the specification of sequence generation has been separated from the @Id annotation, I thought that this meant that sequence generators can be used for any column, and not just for surrogate primary keys. This, however, does not appear to be the case, at least in Glassfish, where if you try to use a sequence generator on any column that is not defined as a surrogate primary key, you get an Exception. You cannot use sequence generators in composite primary keys either.

Update: I could be wrong here because I am getting inconsistent results. More details are in the bug report I have filed with the Glassfish team.

No comments: