3

I am using Grails and connected my app to an Oracle db. When I try to create an object (via the corresponding view in the app front-end) I get this error:

Hibernate: select hibernate_sequence.nextval from dual | Error 2014-03-10 12:03:14,596 [http-bio-8080-exec-5] ERROR util.JDBCExceptionReporter - ORA-02289: sequence does not exist

Of course, adding this manually to the db fixed the issue:

CREATE SEQUENCE hibernate_sequence START WITH 1 INCREMENT BY 1;

But I am wondering why I needed to manually create that seq in the db and why Hibernate couldn't create it automatically. Any idea? Any way I can set Hibernate to create it on its own?

Thanks.

This is my DataSource.groovy, set up with a sand-box db:

dataSource {
    pooled = true
    driverClassName = "oracle.jdbc.OracleDriver"

    dialect = "org.hibernate.dialect.Oracle10gDialect"
    dbCreate = "update" 
    url = "jdbc:oracle:thin:@localhost:1521/ORCL"
    username = <user>
    password = <psw>

    logSql = true

    properties {
        validationQuery="select 1 from dual"
        testWhileIdle=true
        timeBetweenEvictionRunsMillis=60000
    }

}
hibernate {
    cache.use_second_level_cache = true
    cache.use_query_cache = false
    cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
}
3
  • stackoverflow.com/questions/15154366/… Commented Mar 10, 2014 at 20:03
  • How you configured your DataSource? This is in dev/test/prod? Commented Mar 11, 2014 at 1:50
  • This is in Dev. I added DataSource.groovy above. Commented Mar 11, 2014 at 6:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.