+

Search Tips   |   Advanced Search

Set the Java Persistence API (JPA) default persistence provider


Two persistence providers are included in WAS: JPA for WAS persistence provider and Apache OpenJPA persistence provider. The JPA for WAS persistence provider is the default provider for WAS. Use one of the two providers, or a third-party persistence provider, as the default provider.

On the appserver's feature pack for enterprise beans (EJB) 3.0 the default persistence provider, default JTA datasource JNDI name, and default non-JTA datasource JNDI name, values are set through the following JVM properties: com.ibm.websphere.jpa.default.provider, com.ibm.websphere.jpa.default.jta.datasource, and com.ibm.websphere.jpa.default.nonjta.datasource. Support for these properties has been deprecated. Any values that were set through these properties will be displayed as default values on this panel. Any change to these values through the Administrative Console panel will override any values set via the JVM properties. While built from the Apache OpenJPA persistence provider, the JPA for WAS persistence provider contains the following enhancements and differences:

If no JPA provider is configured in the <provider> element of the persistence.xml file within an EJB module, the default JPA provider that is currently configured for this server is used. The WAS is packaged with the JPA for WAS persistence provider defined as the default provider. However, it is possible to override this default and specify a different default via the Websphere Administrative Console.

We can set the default persistence provider in one of two ways. Use one of the following procedures.

 

  1. Select the default JPA provider from a list of providers included with WAS.

    1. Open the admin console.

    2. From the left-hand navigation, navigate to Servers > Application Servers

    3. Select a server.

    4. Navigate to Container Services > Default Java Persistence API Settings

    5. Select Select a default persistence provider that is included with WAS.

    6. Click the slider and select from the list.

    7. Click Apply and save the configuration.

  2. Specify an alternative default persistence provider via the Administrative Console

    1. Open the admin console.

    2. From the left-hand navigation, navigate to Servers > Application Servers

    3. Select a server.

    4. Navigate to Container Services > Default Java Persistence API Settings

    5. Select Specify an alternative default persistence provider .

    6. Enter the fully qualified JPA implementation class name of a JPA persistence provider in the box.

    7. Click Apply and save the configuration.


Default Java Persistence API settings
Set the default JTA and non-JTA data source JNDI Names

 

Related tasks


Set Persistence Provider support in the appserver
Use third-party persistence providers