我有以下映射
@Entity
@SequenceGenerator(name="sacpSequenceGenerator", sequenceName="SACP_SEQ")
public class Sacp {
private Integer id;
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="sacpSequenceGenerator")
public Integer getId() {
return this.id;
}
// other setter's and getter's
}
SACP表的映射根据
ID NUT NULL NUMBER(4)
当我尝试保存 Sacp 实例时,Hibernate 抱怨
ORA-01438: 值大于此列允许的指定精度
即使使用 Long 而不是 Integer,也会引发相同的错误
我应该做什么来修复它?
我找到了这个
SEQ_GEN 使用名为 my_sequence 的序列定义序列生成器。用于此基于序列的 hilo 算法的分配大小为 20。请注意,此版本的 Hibernate Annotations 不处理序列生成器中的initialValue。默认分配大小为 50,因此如果要使用序列并每次获取值,则必须将分配大小设置为 1。
现在效果很好
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)