java - @TableGenerator doesn't work with H2? -


i'm using h2 testing environment app. have table order , start order id 10000. created table column:

@id @tablegenerator(name = "order_gen",               table = "id_gen",               pkcolumnname = "seq_name",               valuecolumnname = "seq_number",               pkcolumnvalue = "order_gen",               initialvalue = 1000) @generatedvalue(strategy = generationtype.table, generator = "order_gen") private long orderid; 

but doesn't work. restarted app, table id_gen created order each time starting 0.

any ideas ?

regards

i found solution here: https://stackoverflow.com/a/13315956/5877109 problem hibernate bug.

after added setting application.properties:

spring.jpa.hibernate.use-new-id-generator-mappings=true 

everything works well.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -