Java Code Examples for javax.transaction.TransactionalException#getCause()
The following examples show how to use
javax.transaction.TransactionalException#getCause() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CdiTransactionRunner.java From crnk-framework with Apache License 2.0 | 5 votes |
@Override public <T> T doInTransaction(Callable<T> callable) { try { return impl.doInTransaction(callable); } catch (TransactionalException e) { // unwrap since not usable, cause more interesting // (validationException, etc.) Throwable cause = e.getCause(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } throw e; } }
Example 2
Source File: CdiTransactionRunner.java From katharsis-framework with Apache License 2.0 | 5 votes |
@Override public <T> T doInTransaction(Callable<T> callable) { try { return impl.doInTransaction(callable); } catch (TransactionalException e) { // unwrap since not usable, cause more interesting // (validationException, etc.) Throwable cause = e.getCause(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } throw e; } }
Example 3
Source File: TransactionExceptionMapper.java From openwebbeans-meecrowave with Apache License 2.0 | 5 votes |
@Override public Response toResponse(final TransactionalException ejbException) { final Throwable cause = ejbException.getCause(); if (cause != null) { final Class causeClass = cause.getClass(); final ExceptionMapper exceptionMapper = providers.getExceptionMapper(causeClass); if (exceptionMapper == null) { return defaultResponse(cause); } return exceptionMapper.toResponse(cause); } return defaultResponse(ejbException); }