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]
}
})
}
}
Insert and update work but I can't delete entity with .delete();
but when commenting static stampable = true then delete works.
The following error occurs when delete action is processed:
groovy.lang.MissingPropertyException: No such property: state for class: org.hibernate.event.spi.PreDeleteEvent