Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » How to catch Exception with PessimisticLock.LockNoWait(PessimisticLock LockNoWait Exception)
How to catch Exception with PessimisticLock.LockNoWait [message #1014227] Mon, 25 February 2013 12:04 Go to next message
Rafa Marcello is currently offline Rafa MarcelloFriend
Messages: 1
Registered: February 2013
Junior Member
i'm using EclipseLink with Pessimistic Lock:

String queryString = "SELECT sfc FROM mytable sfc WHERE";
Query query = em.createQuery( queryString );
query.setHint(QueryHints.PESSIMISTIC_LOCK, PessimisticLock.LockNoWait);
query.setParameter("sfcid", id );
List<MyTable> resList = (List<MyTable>) query.getResultList();

When i try to access a row locked, i have org.eclipse.persistence.exceptions.TransactionException, how i can distinguish Lock cases from the others? Can i use "Instanceof" some class or other methods?

Re: How to catch Exception with PessimisticLock.LockNoWait [message #1014829 is a reply to message #1014227] Tue, 26 February 2013 14:51 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Please include the exception stack trace you are getting. If the exception is being wrapped, you may need to use the caused by of the exception, or pout your try catch around the query execution.

James : Wiki : Book : Blog : Twitter
Previous Topic:Logging differences between Toplink and EclipseLink
Next Topic:Does eclipselink support oracle database column type ordimage?
Goto Forum:

Current Time: Sun May 27 19:54:47 GMT 2018

Powered by FUDForum. Page generated in 0.01568 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top