users@glassfish.java.net

Bind Entity Manager Factory into JNDI

From: <glassfish_at_javadesktop.org>
Date: Thu, 08 Mar 2007 22:53:22 PST

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