Anyone run into an NPE on hibernate's OptimisticLo...
# questions
i
Anyone run into an NPE on hibernate's OptimisticLockStyle? I'm on grails 6.2.3 with hibernate5 8.1.1 and hibernate-core 5.6.15.Final, trying to run bootRun
Copy code
Caused by: java.lang.NullPointerException: Cannot invoke "org.hibernate.engine.OptimisticLockStyle.isAllOrDirty()" because "this.optimisticLockStyle" is null
It seems to be the same issue as this old one, except the fix before was just to upgrade to the latest version of hibernate-core that matches grails hibernate5. In this case I'm already on the latest https://github.com/grails/grails-core/issues/11882
g
It looks like a dependency issue to me, have you tried forging a blank app, see if it runs, and if so using its Gradle
dependencies
section? https://start.grails.org/
i
Discovered that the issue was related to a domain object we had that had a column named
version
that wasn't actually a hibernate version. This worked fine on grails 3 and older hibernate but not after upgrading (currently working through issues with upgrade). Renaming the variable to
vers
and using a mapping like this fixed it:
Copy code
static mapping = {
        version false
        vers column: 'version'
    }
👍 3