新建表执行保存程序时,报错信息如下:
com.dc.base.web.springmvc.ApplicationExceptionResolver,ApplicationExcetpionIntercept:: action throw exception! Error NO:: 88532544-c6b6-495a-9820-c87d73b1c49d
com.dc.base.exception.ApplicationException: could not get next sequence value
原因:
oracle数据库下,序列自增id错误
解决方式:
执行表设计,检查有没有设置id自增:自增自己命名,和实体类相同即可
create sequence SEQ_EN_ENROLL_SCORE_INTERVAL
minvalue 1
maxvalue 9999999999
start with 1
increment by 1
cache 20;
实体类是否添加自增信息:
@Id
@SequenceGenerator(name = “generator”, sequenceName = “SEQ_EN_ENROLL_SCORE_INTERVAL” , initialValue = 1, allocationSize = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = “generator”)
@Column(name = “ID”, nullable = false, precision = 10, scale = 0)
public Long getId() {
return this.id;
}