This content has been marked as final.
Show 1 reply
-
1. Re: JDBCExceptionReporter Transaction is not active:
davidmiller Jul 5, 2011 7:07 AM (in response to davidmiller)I got the answer for this, so thought I would post my solution to hopefully help others in the future.
I changed the code as follows, making it a stateless bean and adding a transaction attribute(TransactionAttributeType.REQUIRES_NEW) to the action method:
@Stateless @Name("exceptionInterceptor") public class ExceptionInterceptor implements ExceptionInterceptorI { @Logger protected transient Log log; @In(required = true) EntityManager entityManager; @Override @Observer({ "org.jboss.seam.async.asynchronousExceptionHandler", "org.jboss.seam.exceptionHandled", "org.jboss.seam.exceptionNotHandled" }) @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void onError(Exception throwable) { Query query = entityManager.createNativeQuery("select * from company where id_com = 8"); query.getResultList(); } private HttpServletRequest getRequest() { return (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest(); } }
Hope that helps someone.
Feel like I'm talking to myself...