大佬教程收集整理的这篇文章主要介绍了postgresql – JPA和Postgres序列预分配大小设置不正确,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
Finest: persist() operation called on: MyUser{ID=null,email=a@e.it,password=test,firstname=test,lastname=test,company=Test}. Finest: Execute query ValueReadquery(sql="SELEct nextval('mom_seq_ID')") Finest: Connection acquired from connection pool [read]. Finest: reconnecTing to external connection pool Fine: SELEct nextval(mom_seq_ID) Finest: Connection released to connection pool [read]. Warning: Local Exception Stack: Exception [Eclipselink-7027] (Eclipse Persistence services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.ValIDationException Exception Description: The sequence named [mom_seq_ID] is setup incorrectly. Its increment does not match its pre-alLOCATIOn size. at org.eclipse.persistence.exceptions.ValIDationException.sequenceSetupIncorrectly(ValIDationException.java:1604) at org.eclipse.persistence.sequencing.StandardSequence.createVector(StandardSequence.java:96) ...
POSTGRes上的序列:
create sequence my_seq_ID INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 27 CACHE 1; alter table my_seq_ID owneR TO POSTGRes; COMMENT ON SEQUENCE my_seq_ID IS 'Sequence for autoincrement ID on MyClass';
以及我的实体的摘录:
@Entity @table(name = "myuser") @XmlRootElement public class MyUser implements serializable { private static final long serialVersionUID = 1L; @ID @SequenceGenerator(name="MYSEQ",sequencename="my_seq_ID") @GeneratedValue(strategy = GenerationType.SEQUENCE,generator="MYSEQ") @Basic(optional = falsE) @column(name = "ID") private Integer ID;
任何人都可以解释什么是错的?
谢谢
我解决了我的问题,但我不知道为什么!我看到alLOCATIOnSize()的默认值是50:
package javax.persistence; @Target(value = {ElementType.TYPE,ElementType.METHOD,ElementType.FIELD}) @Retention(value = RetentionPolicy.RUNTIME) public @interface SequenceGenerator { public String name(); public String sequencename() default ""; public String catalog() default ""; public String scheR_341_11845@a() default ""; public int initialValue() default 1; public int alLOCATIOnSize() default 50; }
我已将我的POSTGRes序列INCREMENT_BY值从1更新为50,现在它可以工作了!
以上是大佬教程为你收集整理的postgresql – JPA和Postgres序列预分配大小设置不正确全部内容,希望文章能够帮你解决postgresql – JPA和Postgres序列预分配大小设置不正确所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。