| This bug was found in 5.0.9 though it seems to be the same for latest versions as well. As part of migration from hibernate 4 to 5, system that already have data and thus can't use the new generators (due to them being incompatible) ran into problems with duplicated ids for primary keys because of the shared hibernate_sequence was used instead of sequence per table (entity) that was already existing and with correct information (current value) in postgresql db. This looks like an issue with wrong parameter name in here: https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/boot/internal/IdGeneratorInterpreterImpl.java#L189 it uses "sequence" instead of "sequence_name" that is expected here: https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/id/enhanced/SequenceStyleGenerator.java#L275 |