The Hibernate version included in JBoss AS 7 comes with Hibernate Envers, which, guess what? Is bugged. When using MySQL, even though you set GenerationType.AUTO
, Envers tries to use sequences. The problem arises if you import data with an import.sql
file at deploy time, as the hibernate_sequence
will be set to value 1, disregarding the hardcoded ids.
Solution: use GenerationType.IDENTITY
when working with MySQL.