Grails 3 Oracle AssertionFailure on Save action with getGeneratedKeys support not enabled Grails 3 Oracle AssertionFailure on Save action with getGeneratedKeys support not enabled oracle oracle

Grails 3 Oracle AssertionFailure on Save action with getGeneratedKeys support not enabled


Ok, when looking into where in the application.yml configuration file to place the suggestion from the first answer presented I discovered that the hibernate.jdbc.use_get_generated_keys = true setting that I used was actually under the grails block. While never working with yml files previously I was not aware of the potential importance of how the indention and blocks formed configuration settings. When I first made edits to the file I looked to see if there was already a hibernate section, I place this setting in that block thus resulting in a setting of grails.hibernate.jdbc.use_get_generated_keys. I created the setting under a root (no indention) for hibernate and tested. The result was successful completion of the action.

I hope that this post will assist other new users in working with this configuration file which seems out of place in a framework centered around groovy. I will look to see if there is an option in creating a new grails application to utilize a groovy configuration file instead of the yml file.


You could also try switching from the identity-sequence generator (the default for Oracle dialect, I believe), to the seq-hilo:

In Grails 2.x, you do it via:

grails.gorm.default.mapping = {    id generator: 'seqhilo', params: [max_lo: 1000]}

I assume it would work similarly in 3.x in the application.yml file. This should prevent hibernate from even needing to use the getGeneratedKeys() method as it will bind the id into the insert from it's own in-memory pool instead of doing a seq.nextval in the insert statement.


Had this problem with Oracle 12, fixed by adding

   jdbc:      use_get_generated_keys: true

and upgrading oracle jdbc driver to ojdbc7 12.1.0.2 (12.1.0.1 doesn't work)