Network Deployment (Distributed operating systems), v8.0 > Administer applications and their environment > Administer EJB applications > Administer applications that use the Java Persistence API


Configure JPA to work in the environment

You have developed the applications to work with Java Persistence API (JPA) and now configure your JPA applications to work in the environment. We must specify options for your database as a part of configuring JPA applications. The application server manages access to data sources. We can configure the data sources, connection pooling, and Java Transaction API (JTA) service in the admin console. If we have a specific data source for the application, configure the data source before you install your JPA application.


Procedure

  1. Configure your data sources through the administrative console. See the topic, Configure a JDBC provider and data source.

  2. Specify the Java Naming and Directory Interface (JNDI) names for the <jta-data-source> and <non-jta-data-source> elements. For example to use JNDI lookup:
    <jta-data-source>jdbc/myJTADataSource
    </jta-data-source>
    <non-jta-data-source>jdbc/myNonJTADataSource
    </non-jta-data-source> 

    If you use the component name space method (for example, java:comp/env) for data source retrieval, ensure that the application defines these resource references so that you can use these JNDI names to access the data source. This component name space configuration provides more flexibility if alter the configuration for the data source. Otherwise, the standard, direct JNDI is used as the data source name. For more information about using the JNDI interface, see the topic, Developing applications that use JNDI. For example, the persistence.xml file would have an entry like the following:

    <jta-data-source>java:comp/env/jdbc/DataSourceJNDI
    </jta-data-source> 
    OR
    <jta-data-source>jdbc/DataSourceJNDI
    </jta-data-source> 
  3. Configure persistence provider support in the application server.

    1. Configure the JPA default persistence provider.

    2. Optional: Use third-party persistence providers.


What to do next

For more information about the commands, classes or other OpenJPA information, refer to the Apache OpenJPA User Guide.
Map persistent properties to XML columns for JPA
Associate persistence providers and data sources
Configure a JDBC provider and data source
Task overview: IBM Optim pureQuery Runtime
Configure pureQuery to use multiple DB2 package collections
Configure JDBC providers to use pureQuery to access DB2
Task overview: Storing and retrieving persistent data with the JPA API
Configure JDBC providers to use pureQuery to access Informix
Configure data source JDBC providers to use pureQuery in a Java SE environment
Develop applications that use JNDI


Related


Apache OpenJPA User Guide: JPA
Apache OpenJPA User Guide: JPA Criteria
Apache OpenJPA User Guide
Dynamic, typesafe queries in JPA 2.0
IBM System i: PTF Cover Letters
IBM Support: Fix Central for DB2 UDB for iSeries V6R1
IBM Support: Fix Central for DB2 UDB for iSeries V5rR3

+

Search Tips   |   Advanced Search