Grails domain beforeInsert / beforeUpdate

前端 未结 2 1295
情深已故
情深已故 2020-12-20 00:40

I want to save my domain class to the database without specifying the createdUser or createdDate. I’ve created an object called AuditingInfo<

相关标签:
2条回答
  • 2020-12-20 01:38

    You can apply your metaClass modifications from within your Bootstrap.groovy, which is executed at start-up.

    0 讨论(0)
  • 2020-12-20 01:45

    agree with doelleri

    just add your code :

    application.domainClasses.each { org.codehaus.groovy.grails.commons.GrailsDomainClass gc ->
                        gc.metaClass.beforeInsert = {
                        }
                        gc.metaClass.beforeUpdate = {
                        }
            }
    

    Into BootStrap.groovy

    0 讨论(0)
提交回复
热议问题