Dha*_*ari 6 java spring hibernate spring-data-jpa spring-boot
使用的数据库是Oracle 11g
Hibernate: select schemaname.col_sqe.nextval from dual
17:06:58.603 [WARN ] -org.hibernate.engine.jdbc.spi.SqlExceptionHelper:SQL Error: 2289, SQLState: 42000
17:06:58.618 [ERROR] -org.hibernate.engine.jdbc.spi.SqlExceptionHelper:ORA-02289: sequence does not exist
Run Code Online (Sandbox Code Playgroud)
该序列存在于数据库中的指定模式中,并且在通过 sql Developer 执行时相同的查询返回正确的值。
自动生成配置如下:
@Id
@SequenceGenerator(name = "COL_GEN", sequenceName = "COL_SQE",schema="SCHEMANAME")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "COL_GEN")
@Column(name = "COL_ID")
Run Code Online (Sandbox Code Playgroud)
Spring JPA配置如下:
spring.jpa.database-platform=org.hibernate.dialect.Oracle10gDialect
spring.jpa.hibernate.use-new-id-generator-mappings=true
spring.jpa.show-sql=true
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15210 次 |
| 最近记录: |