+

Search Tips   |   Advanced Search

Configure JPA to work in the environment

You have developed the applications to work with Java Persistence API (JPA) and now configure the JPA applications to work in the environment.

Specify options for the 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 console. If we have a specific data source for the application, configure the data source before you install your JPA application.

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

  2. Specify the 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 we 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 we can use these JNDI names to access the data source. This component name space configuration provides more flexibility if you must 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, Develop 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.


Subtopics


Related tasks

  • Mapping 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
  • 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

    (V8502) Configure heterogeneous SQL statement batching for JPA applications

  • Criteria API


    Related information:

    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