After upgrading to Hibernate 5 I am getting the error Found use of deprecated [org.hibernate.id.SequenceGenerator]. I found this answer which has a code snippet mentioning how to solve the problem.
I would like to know how that solution works. Does that code snippet do the same thing as the
@SequenceGeneratorannotation? If so why was theSequenceGeneratordeprecated?My annotations are from
javax.persistencepackage. I would prefer to not add hibernate specific stuff in my code. In the answer I have linked there isstrategy = "org.hibernate.id.enhanced.SequenceStyleGenerator",which is hibernate dependent(at least on the runtime). Is there a way to achieve this?When I set
hibernate.id.new_generator_mappings:trueI get unique constraint violation errors