Changing the Provider
This chapter describes how to change the basic provider of JEUS.
1. Changing Persistence Provider
If you want to use providers other than the default provider, change the settings provided by the JPA specifications.
Copy the necessary libraries to the JEUS_HOME/lib/application directory or package each application, and set the <provider> property in the persistence.xml file to the class name of the provider. Corresponding persistence units will use the specified provider.
For configuring each provider, refer to the relevant document because the provider class name and related properties vary depending on the provider. For example, to use Hibernate, the following needs to be configured:
<?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence"> <persistence-unit name="em"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>jdbc/MyDB</jta-data-source> <properties> <!-- add Hibernate properties here --> </properties> </persistence-unit> </persistence>
The default provider can be used or the provider can be changed by persistence unit as shown in the previous example. If the system property jeus.persistence.defaultProvider is set to a provider class name other than the default name when JEUS starts, all other persistence units that do not have a provider configured will use the default provider.
For more information about JEUS system property settings, refer to JEUS Server Guide or JEUS Reference Guide |