[jboss-user] [JBoss Seam] - Seam-managed persistence contexts and Glassfish
giannidoe
do-not-reply at jboss.com
Mon Mar 12 03:53:21 EDT 2007
Has anyone had any success using SMPCs and Glassfish?
All the Glassfish examples I have come accross use a standard JPA persistence context rather than seam-managed i.e.
@PersistenceContext
| EntityManager entityManager;
instead of..
@In
| EntityManager entityManager;
In the Seam documentation for SMPC it says to make sure the EntityManagerFactory is bound into JNDI, which under JBoss is done with a persistence unit property.
<property name="jboss.entity.manager.factory.jndi.name" value="java:comp/env/persistence/My-PU"/>
I can't seem to find any way to do this globally under Glassfish and the only solutions I have come accross is to bind the EntityManagerFactory on an individual ejb basis in ejb-jar.xml
<enterprise-beans>
| <session>
| <ejb-name>MyBean</ejb-name>
| <persistence-unit-ref>
| <persistence-unit-ref-name>persistence/My-PU</persistence-unit-ref-name>
| <persistence-unit-name>My-PU</persistence-unit-name>
| </persistence-unit-ref>
| </session>
| </enterprise-beans>
This approach works fine fine for session beans but doesn't cater for non-ejb components such as the seam EntityConverter. When I try to use <s:convertEntity /> in a select list it fails to find the Persistence Unit in JNDI.
anonymous wrote : Caused by: javax.naming.NameNotFoundException: No object bound to name java:comp/env/persistence/My-PU
| at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:751)
| at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:156)
| at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:307)
| at javax.naming.InitialContext.lookup(InitialContext.java:392)
| at org.jboss.seam.core.ManagedPersistenceContext.getEntityManagerFactoryFromJndiOrValueBinding(ManagedPersistenceContext.java:160)
| ... 65 more
|
Any suggestions as to how to overcome this problem would be much appreciated.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4027068#4027068
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4027068
More information about the jboss-user
mailing list