---
title: "How to deploy the Persistence unit in the global JNDI ? "
author: "winyee"
date: "2009-10-15T18:34:48Z"
tags: []
slug: "how-to-deploy-the-persistence-unit-in-the-global-jndi"
draft: false
lastmod: "2009-10-15T18:34:48Z"
id: 491722
url: "https://winyee.iteye.com/blog/491722"
---

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?

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