Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

em.merge does not throw Optimistic Lock Exception

691068Apr 9 2009
Hello,

we are using Optimistic Lock Exception in a stateful bean managed transaction.

I am wondering that there is no Optimistic Lock Exception is thrown after em.merge

The Optimistic Lock Exception is primary thrown on em.flush - is this right?

A similar problem is described on
http://www.nabble.com/Optimistic-Lock-Exception-expected-td22742662.html#a22742662


See serveroutput: The EclipseLink-5006-Exception is thrown after an em.flush

14:03:11,657 INFO [STDOUT] updateItem
14:03:11,657 INFO [STDOUT] [EL Finest]: 2009-04-09 14:03:11.657--UnitOfWork(14218007)--Thread(WorkerThread#0[192.168.1.217:4518])--Merge clone with references com.tup.model.Person@131a24c
14:03:11,657 INFO [STDOUT] merged
14:03:11,657 INFO [STDOUT] [EL Finest]: 2009-04-09 14:03:11.657--UnitOfWork(14218007)--Thread(WorkerThread#0[192.168.1.217:4518])--Execute query UpdateObjectQuery(com.tup.model.Person@196649c)
14:03:11,657 INFO [STDOUT] [EL Fine]: 2009-04-09 14:03:11.657--ClientSession(21268424)--Connection(25845065)--Thread(WorkerThread#0[192.168.1.217:4518])--UPDATE mku_person_ver SET first_name = ? WHERE ((ID = ?) AND (((last_name = ?) AND (first_name = ?)) AND (version = ?)))
bind => [Bernd 982, 5, Kuls, Bernd 98, 2009-04-09 13:12:15.0]
14:03:11,672 INFO [STDOUT] [EL Warning]: 2009-04-09 14:03:11.672--UnitOfWork(14218007)--Thread(WorkerThread#0[192.168.1.217:4518])--Exception [EclipseLink-5006] (Eclipse Persistence Services - 1.1.0.r3634): org.eclipse.persistence.exceptions.OptimisticLockException
Exception Description: The object [com.tup.model.Person@196649c] cannot be updated because it has changed or been deleted since it was last read.
Class> com.tup.model.Person Primary Key> [5]
14:03:11,688 INFO [STDOUT] [EL Warning]: 2009-04-09 14:03:11.688--UnitOfWork(14218007)--Thread(WorkerThread#0[192.168.1.217:4518])--javax.persistence.OptimisticLockException: Exception [EclipseLink-5006] (Eclipse Persistence Services - 1.1.0.r3634): org.eclipse.persistence.exceptions.OptimisticLockException
Exception Description: The object [com.tup.model.Person@196649c] cannot be updated because it has changed or been deleted since it was last read.
Class> com.tup.model.Person Primary Key> [5]
14:03:11,688 INFO [STDOUT] OptimisticLockException throws MyApplicationException
14:03:11,688 INFO [STDOUT] MyApplicationException
14:03:11,735 INFO [STDOUT] [EL Finer]: 2009-04-09 14:03:11.735--UnitOfWork(14218007)--Thread(WorkerThread#0[192.168.1.217:4518])--TX afterCompletion callback, status=ROLLEDBACK
14:03:11,750 INFO [STDOUT] [EL Finer]: 2009-04-09 14:03:11.75--UnitOfWork(14218007)--Thread(WorkerThread#0[192.168.1.217:4518])--release unit of work
14:03:11,750 INFO [STDOUT] [EL Finer]: 2009-04-09 14:03:11.75--ClientSession(21268424)--Thread(WorkerThread#0[192.168.1.217:4518])--client released
14:03:11,750 ERROR [BMTInterceptor] BMT stateful bean 'ModelFacade' did not complete user transaction properly status=STATUS_MARKED_ROLLBACK


And by this Exception the transaction's status is set to status=STATUS_MARKED_ROLLBACK.
The transaction can no longer be used.

I want to use this transaction further and wrap the OptimisticLockException into an MyApplicationException
(see serveroutput).

But no change!


Any Ideas ?


Regards,
Martin Kubitza
T&P Bochum/Germany
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 7 2009
Added on Apr 9 2009
0 comments
1,404 views