Hi,

do you flush in create() method? if no the exception is thrown at commit
time.

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/2/10 Ricardo <[email protected]>

> Hi, does anyone recognize the following (I will give a short overview of
> the
> context first).
>
> - a RS webservice calls a traditional Service in its @GET method;
> - then the Service calls a DAO class (say, to add a new record).
>
> When there is no unique key conflict, all is well (sic), the transaction
> commits, and some JSON result as programmed in the RS method is sent back
> to
> the caller, as expected.
>
> However, when some unique key conlict arises in the Service's DAO call, the
> transaction is rolled back. That is OK, ofcourse, but...
>
> My problem is that a stack trace is presented to the caller.
>
> I tried to catch any exception that arises through the DAO call in the
> Service, but this does not work.  try { ....; myDao.create(myObject}; ....
> catch (Exception x) { ... }.
>
> Anyone can explain to me why the exception is not catched, but instead
> propagates to the response of the RS call ?
>
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/jax-rs-transaction-exception-not-catched-by-bean-and-propagated-as-response-of-RS-call-tp4660669.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Reply via email to