I have Parent and Child class which has one to many mapping and I want to log Save action on both classes but at the time of saving log parent object is null in child class but it works fine for Parent class log
Here is my AuditLog, Parent and Child class
class AuditLog{
String objectNameType = null;
def onSave = { newMap ->
String objectName = newMap[objectNameType]; // here I am getting null for child class save
//code for storing logs
}
}
class Parent extends AuditLog{
String name;
List child = new ArrayList()
static hasMany = [ child:Child ]
String objectNameType = name;
public String toString(){
return name;
}
}
class child extends AuditLog{
String childName;
static belongsTo =[ parent : Parent];
String objectNameType = parent;
public String toString(){
return childName;
}
}
I am using Grails 1.3.7 version and audit-logging 0.5.5
Any lead will be appreciated.
Thanks in advance