0

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.

Community
  • 1
  • 1
Lucas Oliveira
  • 833
  • 1
  • 10
  • 24

1 Answers1

2

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.

Naros
  • 19,928
  • 3
  • 41
  • 71
  • 1
    It works, but now i have another error: Multiple references to database sequence [hibernate_sequence] were encountered attempting toset conflicting values for 'increment size'. Found [50] and [1] – Lucas Oliveira Feb 01 '17 at 17:29
  • I hope you might have already found this fix but still i mention here so that others can take reference. Your sequence generator in your entities have different incrementSize value 50 and 1. You need to adapt them to have only one incrementSize say 50. – Abhishek-M Jun 15 '17 at 11:11
  • @LucasOliveira I'm getting this too. Did you find a solution? Since the last time it worked properly, I recently added a couple new entities which must somehow be setting an increment value of 1, but I don't know how. I only see this value set in one place, to 50, here: https://github.com/dancancro/great-big-example-application/blob/blogwithkotlin/src/main/resources/config/liquibase/changelog/00000000000000_initial_schema.xml#L13 – Dan Cancro Aug 25 '17 at 03:26