Trans.exec(new Atom() {
@Override
public void run() {
familyMemberService._update(member);
familyInfoService.updateCreditGiver(member.familyCode);
}
});
public void updateCreditGiver(String familyCode) {
//更新农户收信人信息
FamilyInfo familyInfo = this.fetch(familyCode);
if (!Lang.isEmpty(familyInfo.members)) {
familyInfo.creditGiver = "";
for (int i = 0; i < familyInfo.members.size(); i++) {
FamilyMember familyMember = familyInfo.members.get(i);
if (Strings.isNotNull(familyMember.isCreditGiver) && familyMember.isCreditGiver.equals("是")) {
familyInfo.creditGiver += familyMember.name + "(" + familyMember.idNumber + ");" ;
}
}
super._update(familyInfo);
}
}
问题是:事物执行完回滚了,两张表的数据都没有更新,要怎么在一个方法里边用事物控制更新两张表中的数据?