users@glassfish.java.net

Re: Bind Entity Manager Factory into JNDI

From: Sanjeeb Kumar Sahoo <Sanjeeb.Sahoo_at_Sun.COM>
Date: Tue, 13 Mar 2007 00:54:01 +0530

AFAIK, we don't export the EntityManagerFactory(EMF) to JNDI because a
Java EE application component refers to an EMF using either
@PersistenceUnit or <persistence-unit-ref>, both of which directly
refers to the name of the persistence-unit that is bundled in the Java
EE application.

What is Seam framework really expecting at that JNDI name? Will it be
sufficient if you define a <persistence-unit-ref> in your component
deployment descriptor?

Thanks,
Sahoo

glassfish_at_javadesktop.org wrote:
> Hi
> I'm using JBoss Seam with Glassfish and in order to use Seam-managed persistence contexts I need to bind the persistence unit into JNDI.
>
> In JBoss this is done with the following property in the persistence-unit declaration:
> <property name="jboss.entity.manager.factory.jndi.name" value="java:comp/env/persistence/My-PU"/>
>
> persistence.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
> <persistence-unit name="My-PU" transaction-type="JTA">
> <provider>org.hibernate.ejb.HibernatePersistence</provider>
> <jta-data-source>jdbc/mysource</jta-data-source>
> <properties>
> <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
> <property name="hibernate.show_sql" value="true" />
> <property name="jboss.entity.manager.factory.jndi.name" value="java:comp/env/persistence/My-PU"/>
> </properties>
> </persistence-unit>
> </persistence>
>
>
> I'm really struggling to find out how to do the same in Glassfish and I'd appreciate some suggestions.
> Thanks, Gianni
> [Message sent by forum member 'giannidoe' (giannidoe)]
>
> http://forums.java.net/jive/thread.jspa?messageID=207057
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>