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>
Already found the solution