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
@SequenceGenerator
annotation? If so why was theSequenceGenerator
deprecated?My annotations are from
javax.persistence
package. 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:true
I get unique constraint violation errors