My classes use an ID like
@Id @Generated(GenerationTime.INSERT) @GeneratedValue private Integer id;
This works perfectly for H2 (supporting sequences) and gets interpreted for MySql by creating a helper table hibernate_sequence
. Using this answer, everything looks the way I want, especially using a single sequence for all tables.
One thing seems to be wrong: There are multiple rows in the helper table. My id
is declared in a @MappedSuperclass
and during initialization, for each concrete class this line gets executed:
insert into hibernate_sequence values ( 1 )
This is obviously wrong: there is a line per table there and each contains the same value (initially one; when changed, they all change in the same way, as the SQL is update hibernate_sequence set next_val=? where next_val=?
, so it effects all the rows in the same way).
It's harmless, but I wonder: Is it a bug or am I doing something wrong?