We are using Castor with Jrun and have run into an issue with updating the same record more than once inside the same transaction.
The exception is DuplicateIdentityException: update object which is already in the transaction.
I have found that it's thrown on line 904 in TransactionContext.java, here's a snip of code:
if ( entry != null ) {
if ( entry.deleted )
throw new ObjectDeletedException( Messages.format("persist.objectDeleted", object.getClass(), identity ) );
else
throw new DuplicateIdentityException( "update object which is already in the transaction" );
}
We have the need to allow updates to the same record more than once, with the behavior that the last update is the one that is commited.
We have modified the code temporarily to:
if ( entry != null ) {
if ( entry.deleted )
throw new ObjectDeletedException( Messages.format("persist.objectDeleted", object.getClass(), identity ) );
//else
//throw new DuplicateIdentityException( "update object which is already in the transaction" );
}
And this seems to work perfectly for us. Does anyone see any side affects from this?
It would be nice to engineer this as to set this behavior on and off.
Darrell May
Software Architect
Cyberplex
Waterloo Development Center
[EMAIL PROTECTED]
http://www.cyberplex.com
