0

Id generation in jpa

How to create id in a table using @GeneratedValue in jpa start with 1000 and increment by 50, and last Id value be 9950 like below: 1000 1050 1100 1150 ... ... ... 9950

23rd Apr 2020, 8:34 AM
hamid
hamid - avatar
1 ответ
0
@Entity @SequenceGenerator(name="seq", initialValue=1, allocationSize=100) public class EntityWithSequenceId { @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="seq") @Id long id; }
30th May 2020, 6:56 PM
subodha herath
subodha herath - avatar