Lucas Oliveira
Lucas Oliveira

Reputation: 883

deprecated SequenceHiLoGenerator sequence-based id generator; use SequenceStyleGenerator instead

my application is logging

org.hibernate.orm.deprecation : HHH90000014: Found use of deprecated [org.hibernate.id.SequenceHiLoGenerator] sequence-based id generator; use org.hibernate.id.enhanced.SequenceStyleGenerator instead. See Hibernate Domain Model Mapping Guide for details.

There is a similar question about this here that fix the problem, but my question is if it's possible replace the Sequence generator org.hibernate.id.SequenceHiLoGenerator to org.hibernate.id.enhanced.SequenceStyleGenerator without go throught every single domain class annotations writing a custom @GenericGenerator? Something like a property maybe...

My code has something like this:

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seq_name")
@SequenceGenerator(name="seq_name", sequenceName="hibernate_sequence")
private Long id;

Thank you.

Upvotes: 1

Views: 4142

Answers (1)

Naros
Naros

Reputation: 21123

You should be able to set hibernate.id.new_generator_mappings to true, which is the default in Hibernate 5, and that should disable the legacy behavior and automatically selecting the enhanced generator.

Upvotes: 2

Related Questions