package products
import fiscalYears.FiscalYear
class Catagorie {
String productCatagory;
Date dateCreated
Date lastUpdated
String lastUpdatedBy
String createdBy
static constraints = {
lastUpdatedBy nullable: true;
createdBy nullable: true;
}
static belongsTo = [fiscalYear:FiscalYear];
static auditable = true
static stampable = true
def onSave = {
println "new catagorie inserted"
// may optionally refer to newState map
}
def onDelete = {
println "catagorie was deleted"
// may optionally refer to oldState map
}
def onChange = { oldMap,newMap ->
println "catagorie was changed ..."
oldMap.each({ key, oldVal ->
if(oldVal != newMap[key]) {
println " * $key changed from $oldVal to " + newMap[key]
}
})
}
}
插入和更新工作,但我无法删除.delete()
的实体;
但在评论static stampable = true
时,删除工作。
处理删除操作时发生以下错误:
groovy.lang.MissingPropertyException:没有这样的属性:state for class:org.hibernate.event.spi.PreDeleteEvent