gpc / grails-audit-logging-plugin

The Grails Audit Logging Plugin
Apache License 2.0
50 stars 60 forks source link

Get timestamp Class using PersistentEntity rather than MetaClass #218

Closed alanwilkie-finocomp closed 3 years ago

alanwilkie-finocomp commented 3 years ago

I struck a problem while upgrading a project to Grails 4.0.10 where the metaClass.hasProperty mechanism used previously seems to always return null. I think the timestamps were actually being set by some other Grails/GORM mechanism. With Grails 4.0.10 I started getting errors where it was trying to insert null into the not-null date_created column.

The change I'm proposing uses the GORM PersistentEntity for the domain class to find the datatype of the timestamp properties, which is more akin to what Grails/GORM does.

The changes in build.gradle are what I had to do to get the project to build locally, I don't know if they're necessary in all environments.

robertoschwald commented 3 years ago

Thanks!