Thank you Romain,

I can handle OptimisticLockException by calling flush() after causing the
exception as you mentioned.
Thank you for your help.
However I do not know why Glassfish does not have to call it. Checking the
flush mode, I found out both Glasshfish and TomEE use "AUTO" mode.
Incidentally I also found out if I do not call flush(), I cannot catch the
exception inside the function in Stateless Session EJB but can catch it
outside, in my case inside CDI. However in case of Glassfish, I can catch
the exception inside the function in Stateless Session EJB even if I do not
call flush().

Many Thanks



--
View this message in context: 
http://openejb.979440.n4.nabble.com/How-can-I-catch-OptimisticLockException-tp4658313p4658339.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Reply via email to