Uploaded image for project: 'Seam 2'
  1. Seam 2
  2. JBSEAM-2311

Injected hibernate session breaks removal of event scoped stateful session bean

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.0.GA
    • Fix Version/s: The future
    • Component/s: Core
    • Labels:
      None
    • Environment:

      JBoss 4.2

      Description

      When using a JPA delegate as injected Hibernate session as suggested in chapter 8.4 of documentation, the removal of an event scoped SFSB breaks because when Seam intercepts the @Remove method and tries to inject the Hibernate session, the EntityManager will be already closed.

      components.xml:

      <persistence:managed-persistence-context name="entityManager" auto-create="true" persistence-unit-jndi-name="java:/EntityManagerFactories/Argos3EJBPU" />
      <factory name="session" scope="STATELESS" auto-create="true" value="#

      {entityManager.delegate}

      " />

      SFSB:
      @Stateful
      @Name("aufgabenliste")
      @Scope(ScopeType.EVENT)
      public class AufgabenlisteImpl implements Aufgabenliste {
      @In
      private Session session;

      @Remove
      public void remove() {
      }
      }

      Gives the following exception upon closing of the event context:
      13:02:25,091 WARN [Component] Exception calling stateful session bean default @Remove method: aufgabenliste
      javax.ejb.EJBException: javax.el.ELException: Error reading 'delegate' on type org.jboss.seam.persistence.EntityManagerProxy
      at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
      at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
      ...
      Caused by: javax.el.ELException: Error reading 'delegate' on type org.jboss.seam.persistence.EntityManagerProxy
      at javax.el.BeanELResolver.getValue(BeanELResolver.java:66)
      at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
      at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
      at org.jboss.el.parser.AstPropertySuffix.getValue(AstPropertySuffix.java:53)
      at org.jboss.el.parser.AstValue.getValue(AstValue.java:67)
      at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
      at org.jboss.seam.core.Expressions$1.getValue(Expressions.java:112)
      at org.jboss.seam.Component.getInstanceFromFactory(Component.java:1906)
      ...
      Caused by: java.lang.IllegalStateException: EntityManager is closed
      at org.hibernate.ejb.EntityManagerImpl.getSession(EntityManagerImpl.java:42)
      at org.hibernate.ejb.AbstractEntityManagerImpl.getDelegate(AbstractEntityManagerImpl.java:570)
      at org.jboss.seam.persistence.EntityManagerProxy.getDelegate(EntityManagerProxy.java:95)

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                mschmidke Marcus Schmidke
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: