Hibernate 7 deprecates @GenericGenerator for custom identifier generation. The recommended replacement is @IdGeneratorType, which allows creating custom annotations like @Tsid for cleaner entity mappings. This approach simplifies code by eliminating verbose configuration and enables reusing generators for both identifier and non-identifier attributes. The article demonstrates migrating common use cases including TSID generation and pooled-lo sequence optimizer configuration, with ready-to-use implementations available in Hypersistence Utils.
Table of contents
IntroductionHibernate @GenericGenerator annotationHow to map a custom entity identifier generatorHow to configure the `pooled-lo` optimizer without the @GenericGeneratorConclusionSort: