質問

I have the following code in our Struts action class:

        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());
                        }
                    });

The code above calls into our BaseDAO class (which uses 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();
        }
    }

The code is only updating the Notify column, the sysDttm and SysPin columns don't get updated at all. These are the two variables and their methods.

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;
}

Any suggestions?

Thanks,

Tom

役に立ちましたか?

解決

This issue was with the descriptor in the xml file ClerkReviewCaseDocRecipient.ClassDescriptor.xml. I didn't have the proper links set with the sys_dttm and sys_pin columns. I found this when reviewing the configuration in the TopLink WorkBench. I appreciate everyone's help and suggestions.

Thanks, Tom

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top