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
Hello,
i'm using EclipseLink with Pessimistic Lock:

String queryString = "SELECT sfc FROM mytable sfc WHERE sfc.id=:sfcid";
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?

Thanks
Rafa
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: Thu Dec 18 19:37:11 GMT 2014

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

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