0
1対多マッピングを持つ親クラスと子クラスがあり、両方のクラスで保存アクションをログに記録したいが、ログ親オブジェクトの保存時に子クラスではnullそれは私がGrailsの1.3.7バージョンと監査ログ0.5.5子クラスの監査ログでの親名の取得Grails
どれでもつながるを使用しています私の監査ログ、親と子のクラスは
ある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;
}
}
ここでは、親クラスのログ
のために正常に動作します感謝する。コントローラには、事前
いくつかのアウトプリント(どの点がヌルであるか)を含むコントローラアクションを示します。 –