FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 4134 Ask New Question


I have following code in my POJO

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;

On startup Hibernate giving me the following warning

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


1 Answer


Start using GenericGenerator for sequence generation.

declare your GenericGenerator with the following code

    @GenericGenerator(
            name = "userSequenceGenerator",
            strategy = "org.hibernate.id.enhanced.SequenceStyleGenerator",
            parameters = {
                    @Parameter(name = "sequence_name", value = "userSequence"),
                    @Parameter(name = "initial_value", value = "1"),
                    @Parameter(name = "increment_size", value = "1")
            }
    )

and start using it for your id field

@Id
    @GeneratedValue(generator = "userSequenceGenerator")
    private Long id;
On By


Answer This Question


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News