Grails domain beforeInsert / beforeUpdate

前端 未结 2 1297
情深已故
情深已故 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: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

提交回复
热议问题