jpa中主键使用oracle序列
jpa中主键使用oracle序列
实体类配置
@Id @GeneratedValue(strategy=GenerationType.SEQUENCE,generator="mseq") @SequenceGenerator(name="mseq",sequenceName="metadata_seq",allocationSize=1) @Column(name = "ENTID", unique = true, nullable = false, precision = 22, scale = 0) public long getEntid() { return this.entid; }
sequenceName 是自己在oracle中创建的序列。allocationSize要指定为1,否则它会按照默认50个数字增长。
http://five.iteye.com/blog/1722135
相关推荐
周公周金桥 2020-09-06
zjuwangleicn 2020-09-04
hellowzm 2020-08-18
大象从不倒下 2020-07-31
AlisaClass 2020-07-19
尚衍亮 2020-06-12
淡风wisdon大大 2020-06-06
黎豆子 2020-05-07
hilary0 2020-05-04
zhanghao 2020-04-21
MaureenChen 2020-04-21
xingguanghai 2020-03-13
nercon 2020-02-22
impress 2020-02-20
ajaxtony 2020-02-18
teresalxm 2020-02-18
福叔 2020-02-16
mituan 2020-01-17