ITeye博客

How to deploy the Persistence unit in the global JNDI ?

winyee · 2009-10-15 18:34 · 笔记 · Markdown

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

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。