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'
}