Hibernate 6.2 strategy deprecated (strategy = "enhanced-sequence")

The hibernate 6.2 depreciated “strategy”. In our current code base we are using


@GenericGenerator(
        name = "sequenceGenerator",
        strategy = "enhanced-sequence",
        parameters = {
            @org.hibernate.annotations.Parameter(
                name = "optimizer",
                value = "pooled-lo"
            ),
            @org.hibernate.annotations.Parameter(
                name = "initial_value",
                value = "1"
            ),
            @org.hibernate.annotations.Parameter(
                name = "increment_size",
                value = "5"
            )
        }
    )

But I am not user how shall I replace it with new approach. And seems no clear documentation related it( at least I couldn’t find)

As specified in the deprecation javadoc, you should use the new annotation’s type() member for typesafety. In your case type = SequenceStyleGenerator.class will result in the same configuration you’re currently using.

1 Like