我有以下JPA实体:

@Entity
@Table(schema = "myschema")
@SequenceGenerator(schema = "myschema", name = "seqGenerator",
                   sequenceName  = "person_s1", allocationSize = 1)
public class Person {

@Id
@GeneratedValue(generator = "seqGenerator", strategy = GenerationType.AUTO)
private long id;

抛出以下异常:
Call: DROP SEQUENCE myschema.person_s1
Query: DataModifyQuery(sql="DROP SEQUENCE myschema.person_s1")
[EL Warning]: 2010-11-01 17:21:51.051--ServerSession(10605044)--Exception [EclipseLink-    4002] (Eclipse Persistence Services - 2.1.1.v20100817-r8050):
org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: ORA-02289: sequence does not exist

Error Code: 2289
Call: SELECT myschema.person_s1.NEXTVAL FROM DUAL
Query: ValueReadQuery(sql="SELECT myschema.person_s1.NEXTVAL FROM DUAL")

该序列由EclipseLink和查询生成:
SELECT myschema.person_s1.NEXTVAL FROM DUAL

直接使用时效果很好...

任何帮助表示赞赏

问候马塞尔

最佳答案

抛出以下异常(...)

当特定数据库对象不存在且因此无法删除时,这些跟踪是在模式创建期间生成的。 EclipseLink报告了诸如Warning(不是Error)之类的情况,可以将其忽略(您可以得到序列了吧?)。

PS:为什么您使用分配大小1,您是否不想从高/低优化中受益?

09-16 04:16