Incompatible sequence names between Liquibase and Hibernate JPA for PostgreSQL and H2
Use GenerationType.IDENTITY
. This should work on most DBs.
Identity generation is one of the warts of JPA in my opinion; it's too hard to set global overrides for generation options based on the DB you're using, etc. Doing it in annotations makes it hard to adjust programmatically.
Hibernate's bizarre hibernate_sequence
is particularly painful. It's beyond me why it doesn't use the PostgreSQL default sequences for generated columns.