[jboss-user] [JNDI/Naming/Network] - Hibernate configuration with JNDI

TurangaLeela do-not-reply at jboss.com
Wed Aug 20 06:11:34 EDT 2008


I know how I can configure datasource with JNDI (create xxx-ds.xml file).

And now I want to move my hibenate configuration properties definition away from persistence.xml and make them available via JNDI.  

I have googled a bit and found JNDIBindingServiceMgr () that allows to bind arbitrary values into JNDI and, as it is stated here (http://www.redhat.com/docs/manuals/jboss/jboss-eap-4.3/doc/Server_Configuration_Guide/html-single/index.html#Additional_Naming_MBeans-JNDI_Binding_Manager) even java.util.Properties object can be mapped.

So I see the way to define hibernate properties in JNDI. But I do not see the way to reference them in persistense.xml (like I deal with datasource, please see below). Is there any possibility to do that?


  | <?xml version='1.0' encoding='utf-8'?>
  | <persistence xmlns="http://java.sun.com/xml/ns/persistence"
  | 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
  | 
  | <persistence-unit name="myEntityManager" transaction-type="JTA">
  | 	
  |     <jta-data-source>java:/ewsDatasource</jta-data-source>
  | 
  |     <properties>
  |         <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
  |         </property>
  |         [more properties here]
  |     </properties>
  | 
  | </persistence-unit>
  | </persistence>
  | 

Thaks! http://wiki.jboss.org/wiki/JNDIBindingServiceMgr

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4171454#4171454

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4171454



More information about the jboss-user mailing list