Chapter 3. Changing the Provider

Table of Contents

3.1. Changing the Persistence Provider
3.2. Other Persistence Providers

This chapter describes how to change the basic provider of JEUS.

3.1. Changing the 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:

[Example 3.1] Changing Persistence Provider

<?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.

Note

For more information about how to configure the JEUS system properties, refer to "JEUS Server Guide" and "JEUS Reference Book".

3.2. Other Persistence Providers

For information about other persistence providers, refer to the following sites: