[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-2311) Injected hibernate session breaks removal of event scoped stateful session bean

Marcus Schmidke (JIRA) jira-events at lists.jboss.org
Wed Nov 28 08:59:46 EST 2007


Injected hibernate session breaks removal of event scoped stateful session bean
-------------------------------------------------------------------------------

                 Key: JBSEAM-2311
                 URL: http://jira.jboss.com/jira/browse/JBSEAM-2311
             Project: JBoss Seam
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.0.0.GA
         Environment: JBoss 4.2
            Reporter: Marcus Schmidke


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)


-- 
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