ORA-02201:Hibernate @SequenceGenerator不允许使用序列

ORA-02201: sequence not allowed here with Hibernate @SequenceGenerator

提问人:mcfly soft 提问时间:4/7/2021 最后编辑:mcfly soft 更新时间:4/7/2021 访问量:309

问:

我收到以下错误:

error performing isolated work; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: error performing isolated work
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:259)
...
...
Caused by: org.hibernate.exception.SQLGrammarException: error performing isolated work
...
...
Caused by: java.sql.SQLSyntaxErrorException: ORA-02201: sequence not allowed here

我有一个这样的实体:

@Entity
@Data
@Table(name = "mytable", schema = "myschema")
@NoArgsConstructor
@AllArgsConstructor
@SequenceGenerator(name="mygenerator", sequenceName = "myschema.myseq",allocationSize = 1)
public class MYENTITY {

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "mygenerator")
private Long id;
}

序列“myseq”存在。

任何线索,为什么我得到错误?

Hibernate方言: spring.jpa.properties.hibernate.dialect=com.asb.anna.web.repository.Oracle12cDialectBugfixImpl

Oracle 休眠 序列

评论

0赞 crizzis 4/7/2021
您使用的是哪个数据库?
0赞 Marmite Bomber 4/7/2021
ORA-error 表示 Oracle,它也被标记为 @crizzis
0赞 Marmite Bomber 4/7/2021
您必须发布导致异常的语句。基本上,该错误意味着生成的查询违反了对序列值的某些限制
0赞 SternK 4/7/2021
@mcflysoft 你用什么冬眠方言?
0赞 mcfly soft 4/7/2021
我在问题中添加了方言。也许这就是问题所在?

答: 暂无答案