Configure JPA to work in your environment

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

About this task

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

Procedure

  1. Configure your data sources through the administrative console. See the topic, Configuring 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 your 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 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, 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. Configuring the JPA default persistence provider.
    2. Optional: Using 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.



In this information ...


Related reference

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_configjpa
File name: tejb_configjpa.html