Developing
applications that use the Java Persistence API
Subtopics:
Developing JPA 2.x applications for a Java EE environment
Containers in the application server can provide many of
the necessary functions for the Java Persistence
API (JPA) in a Java Enterprise
Edition (Java EE) environment.
The application server also provides JPA command tools to assist you
with developing applications in a Java EE
environment.
Bean validation in JPA
Data validation is a common task that occurs in all layers
of an application, including persistence. The Java Persistence API (JPA) 2.0 provides support
for the Bean Validation API so that data validation can be done at
run time. This topic includes a usage scenario where bean validation
is used in the JPA environment of a sample digital image gallery application.
wsjpa properties
The extension properties of Java Persistence
API (JPA) for WebSphere® Application
Server can be specified with the openjpa or wsjpa prefix. This topic
features the wsjpa properties.
Criteria API
The Criteria API is an API for building queries with Java objects, as an alternative
to building strings for Java Persistence
Query Language (JPQL) queries.
wsappid command
The Java Persistence API (JPA) specification
supports an entity primary key to be made up of more than one column.
In this case, the primary key is called a composite or compound primary
key. Provide an ID class, which is specified by the @IdClass annotation,
to manage a composite primary key. Use the identity tool for JPA to
generate an ID class for entities that use composite primary keys.
wsenhancer command
The entity enhancer tool for Java Persistence
API (JPA) applications inserts bytecode into an entity class file
that supports the JPA provider to manage the state of an entity.
wsmapping command
The wsmapping tool is used to provide top-down mapping
of the entity object model to the database relational model. You can
use the wsmapping tool to create database tables.
wsreversemapping command
The wsreversemapping tool generates persistent class definitions
and metadata from a database schema.
wsschema command
The schema tool can be used to view the database schema
in XML form or match an XML schema to an existing database.
wsdbgen command
The command supports utilization of the pureQuery feature
in Java Persistence API (JPA)
applications.
ANT task WsJpaDBGenTask
The ANT task WsJpaDBGenTask provides
an alternative to the wsdbgen command.
Database generated version ID with JPA
Java Persistence
API (JPA) for WebSphere Application
Server has extended OpenJPA to work with database generated version
IDs. These generated version fields, timestamp, or token, can be
used to efficiently detect changes to a given row.
Mapping persistent properties to XML columns for JPA
If your database supports Extensible Markup Language (XML)
column types, you can use mapping tools to manage XML objects. You
have the choice of mapping XML columns to a Java string or a Java byte
array field.
Directory conventions
References in product information to app_server_root, profile_root,
and other directories imply specific default directory locations.
Become familiar with the conventions in use for WebSphere Application
Server.