Skip to content
Advertisement

ORA-02289: sequence does not exist – when using Spring Data JPA with Spring boot

Database being used is 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

The sequence is present in the specified schema in the database and the same query returns proper value when executed via sql developer.

The Auto generation configuration is as follow:

@Id
    @SequenceGenerator(name = "COL_GEN", sequenceName = "COL_SQE",schema="SCHEMANAME")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "COL_GEN")
    @Column(name = "COL_ID")

Spring JPA configuration is as follow:

spring.jpa.database-platform=org.hibernate.dialect.Oracle10gDialect
spring.jpa.hibernate.use-new-id-generator-mappings=true
spring.jpa.show-sql=true

Advertisement

Answer

Kindly check if the user which you are using has the read/write privilege

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement