How to deploy the Persistence unit in the global JNDI ?

jboss recipe of the day

By default the persistence unit are available in the java: Context. If you wish to make them available also in the global naming Context you have to add two properties to your persistence.xml configuration file:

view plaincopy to clipboardprint?
   <persistence>
   <persistence-unit name="manager1">
      <jta-data-source>java:/MySQLDS</jta-data-source>
      <properties>
         <property name="jboss.entity.manager.jndi.name" value="java:/Manager1"/>
         <property name="jboss.entity.manager.factory.jndi.name" value="java:/Manager1Factory"/>
      </properties>
   </persistence-unit>
</persistence>


jboss.entity.manager.jndi.name gives you a transaction scoped entity manager you can interact with, while jboss.entity.manager.factory.jndi.name binds the entity manager factory into global JNDI.

http://www.mastertheboss.com/en/jboss-howto/45-jboss-persistence/188-how-to-deploy-the-persistence-unit-in-the-global-jndi-.html

你可能感兴趣的:(java,html,xml,jboss)