- The unit tests
OverrideGenericGeneratorTestCase
andOverrideIdGeneratorTypeTestCase
execute different SQL statements when creating a new entity - The database schema is created by Hibernate using
hibernate.hbm2ddl.auto=create
- Both tests define the default entity mapping with annotations and override the strategy for generating a new id with an XML mapping file
- The default strategy is to use sequences following a naming convention for table names
- The XML metadata should override the strategy to
IDENTITY
in both test cases, but this only works for@GenericGenerator
- The logic for providing portability depending on the DBMS is omitted
- Further reading:
- Overrides the deprecated @GenericGenerator
- The executed SQL does not contain a database sequence
- The new @IdGeneratorType (Hibernate 6.0) cannot be overwritten
- The executed SQL contains the creation and use of a database sequence