我在Struts动作类中有以下代码:
clerkReviewDao.transaction(clerkReviewCaseRecipient,
new TransactionBlock<ClerkReviewCaseRecipient>() {
public void merge(
ClerkReviewCaseRecipient detached,
ClerkReviewCaseRecipient managed) {
managed.setNotify("Y");
managed.setSysDttm(new Date());
managed.setSysPIN(HttpDBSessionMgr.getSessionInfo(request).getUserPin());
}
});
上面的代码调用我们的BaseDAO类(使用Toplink)
import oracle.toplink.publicinterface.Session;
import oracle.toplink.publicinterface.UnitOfWork;
public T transaction(T detached, TransactionBlock transactionBlock) throws BadDBConnection {
Session session = centralSourceInjector.inject();
UnitOfWork uow = session.acquireUnitOfWork();
try {
T managed = (T)uow.registerObject((T) detached);
transactionBlock.merge(detached, managed);
uow.commit();
session.refreshObject(detached);
return managed;
} catch(OptimisticLockException ole){
uow.rollbackTransaction();
throw ole;
} finally {
uow.release();
}
}
代码只更新Notify列,sysDttm和SysPin列根本没有更新。这是两个变量及其方法。
private Date sysDttm;
private String sysPIN;
public Date getSysDttm() {
return sysDttm;
}
public void setSysDttm(Date sysDttm) {
this.sysDttm = sysDttm;
}
public String getSysPIN() {
return sysPIN;
}
public void setSysPIN(String sysPIN) {
this.sysPIN = sysPIN;
}
有什么建议吗?
谢谢,
汤姆
答案 0 :(得分:0)
此问题与xml文件ClerkReviewCaseDocRecipient.ClassDescriptor.xml中的描述符有关。我没有使用sys_dttm和sys_pin列设置正确的链接。我在查看TopLink WorkBench中的配置时发现了这一点。我感谢大家的帮助和建议。
谢谢, 汤姆