Configuring the JPA default persistence provider

Two persistence providers are included in the product: JPA for WebSphere® Application Server persistence provider and Apache OpenJPA persistence provider. The Java Persistence API (JPA) for WebSphere Application Server persistence provider is the default provider for the product. You can use one of these two providers, or a third-party persistence provider, as the default provider.

About this task

Attention: If you have a default persistence provider, default Java Transaction API (JTA) data source Java Naming and Directory Interface (JNDI) name, and default non-JTA data source JNDI name values that were set in the product before V7.0, through the Java virtual machine (JVM) properties, any change to these values through the administrative console override values that were set with the JVM properties.

These properties include, 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 are displayed as default values on this panel. These values that are set through the administrative console panel overrides any values set through the JVM properties.

JPA for WebSphere persistence provider

While built from the Apache OpenJPA persistence provider, the JPA for WebSphere Application Server persistence provider contains the following enhancements and differences:
  • Static SQL support using the DB2® pureQuery feature
  • Access intent support
  • Enhanced tracing support
  • Version ID generation
  • WebSphere product-specific commands and scripts
  • Translated message files
  • The following table shows how the default values for the JPA for WebSphere Application Server persistence provider configuration properties are different from the Apache OpenJPA provider:
    Table 1. Comparison. JPA for WebSphere Application Server persistence provider and Apache OpenJPA provider comparison
    Property Apache OpenJPA default value JPA for WebSphere Application Server persistence provider default value
    openjpa.Compatibility StrictIdentityValues=false StrictIdentityValues=true
    openjpa.RuntimeUnenhancedClasses supported warn
    openjpa.DynamicEnhancementAgent true false
    open.jdbc.DriverDataSource auto simple
Avoid trouble Avoid trouble: The OpenJPA compatibility property does not remove proxy types that OpenJPA generates for certain data types, especially date types such as GregorianCalendar. This omission can cause problems with deserialization. If a deserialization problem occurs, an error message, similar to the following message, is issued:gotcha
Error Message is:org.codehaus.jackson.map.JsonMappingException: 
Can not construct instance of org.apache.openjpa.util.java$util$GregorianCalendar$proxy, 
problem: no suitable creator method found at 
[Source: org.apache.http.conn.EofSensorInputStream@d83fbd5; line: 1, column: 4094]

In addition to the above property overrides, the use of the default JPA for WebSphere Application Server persistence provider also implies the use of the following JPA for WebSphere Application Server classes which override the corresponding classes in Apache OpenJPA:

com.ibm.ws.persistence.jdbc.kernel.ConstraintUpdateManager;
com.ibm.ws.persistence.jdbc.kernel.WsJpaJDBCBrokerFactory;
com.ibm.ws.persistence.jdbc.sql.DB2Dictionary;
com.ibm.ws.persistence.jdbc.sql.OracleDictionary;
com.ibm.ws.persistence.jdbc.sql.SQLFactoryImpl;
com.ibm.ws.persistence.jdbc.sql.SQLServerDictionary;
com.ibm.ws.persistence.kernel.WsJpaBrokerImpl;
com.ibm.ws.persistence.kernel.WsJpaFinalizingBrokerImpl;

If no JPA provider is configured in the <provider> element of the persistence.xml file within an Enterprise JavaBeans (EJB) module, the default JPA provider that is currently configured for this server is used. The product is packaged with the JPA for WebSphere Application Server persistence provider defined as the default provider. However, it is possible to override this default and specify a different default through the administrative console.

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

Procedure

  1. Select the default JPA provider from a list of providers included with the product.
    1. Open the administrative console.
    2. Click Servers > Application Servers
    3. Select a server.
    4. Click Container Services > Default Java Persistence API Settings
    5. Select Select a default persistence provider that is included with WebSphere Application Server.
    6. Click the slider and select from the list.
    7. Click Apply and save the configuration.
  2. Specify an alternative default persistence provider through the administrative console
    1. Open the administrative console.
    2. Click Servers > Application Servers
    3. Select a server.
    4. Click 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.



In this information ...


IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic Task topic    

Terms and conditions for information centers | Feedback

Last updatedLast updated: Jan 30, 2014 9:17:32 AM CST
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=matt&product=was-nd-iseries&topic=tejb_jpadefaultpp
File name: tejb_jpadefaultpp.html