[jbossseam-issues] [JBoss JIRA] Updated: (JBSEAM-957) Support transaction interceptor with JavaBeans and custom servlets

Gavin King (JIRA) jira-events at lists.jboss.org
Wed Mar 7 19:31:22 EST 2007


     [ http://jira.jboss.com/jira/browse/JBSEAM-957?page=all ]

Gavin King updated JBSEAM-957:
------------------------------

    Fix Version/s:     (was: 1.2.1.GA)

> Support transaction interceptor with JavaBeans and custom servlets
> ------------------------------------------------------------------
>
>                 Key: JBSEAM-957
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-957
>             Project: JBoss Seam
>          Issue Type: Feature Request
>          Components: Core
>            Reporter: Christian Bauer
>         Assigned To: Gavin King
>            Priority: Minor
>
> I'm using  <web:context-filter url-pattern="/files/*"/> and a custom FileServlet:
> This works:
>     @Override
>     protected void doGet(HttpServletRequest request, HttpServletResponse response)
>             throws ServletException, IOException {
>             String id = request.getParameter("fileId");
>             NodeDAO nodeDAO = (NodeDAO) org.jboss.seam.Component.getInstance("nodeDAO");
>             org.jboss.seam.wiki.core.node.File file;
>             UserTransaction userTx = null;
>             try {
>                 userTx = Transactions.getUserTransaction();
>                 userTx.begin();
>                 file = (id != null && !"".equals(id)) ? nodeDAO.findFile(Long.getLong(id)) : null;
>                 userTx.commit();
>             } catch (Exception ex) {
>                 try {
>                     if (userTx != null) userTx.rollback();
>                 } catch (Exception rbEx) {
>                     rbEx.printStackTrace();
>                 }
>                 throw new RuntimeException(ex);
>             }
>  
> This doesn't work because no JTA transaction is active when my JavaBean DAO is called (all methods there are annotated @Transactional):
>     @Override
>     protected void doGet(HttpServletRequest request, HttpServletResponse response)
>             throws ServletException, IOException {
>             String id = request.getParameter("fileId");
>             NodeDAO nodeDAO = (NodeDAO) org.jboss.seam.Component.getInstance("nodeDAO");
>             org.jboss.seam.wiki.core.node.File file = (id != null && !"".equals(id)) ? nodeDAO.findFile(Long.getLong(id)) : null;
> The Seam (seamspace) examples use EJB components, so this probably never came up before.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list