+

Search Tips   |   Advanced Search

wsmapping command

The wsmapping tool is used to provide top-down mapping of the entity object model to the database relational model. Use the wsmapping tool to create database tables.


Syntax

Before running the command, have a copy of persistence.xml on the class path, or specify it as a properties file in the -p [/path/to/persistence.xml] argument. Issue the command from the bin subdirectory of the profile_root directory.

The command syntax is as follows:

(zos)

(iseries)


Parameters

The mapping tool accepts the standard set of command-line arguments defined by the configuration framework with the following options:

Each additional argument to the wsmapping tool must be one of the following:

If we do not supply any arguments to the wsmapping tool, it runs on the classes in the persistent classes list.


Usage

Before running the wsmapping tool, configure the data source information, including the URL, user, and password. It is required that the wsenhancer tool is run before the wsmapping tool to insert bytecode into the entity classes. Also, the compiled class files for the entities should be on the class path. Assume that entity class files can be found in target/classes, for example:

(zos)

(iseries)

To create tables, run the wsmapping command from the ${profile_root}/bin directory. When completed, the database tables are created or updated. Messages and errors are logged to the console as specified by log settings.

wsmapping.sh . . . On Windows :

By specifying the buildSchema parameter to the openjpa.jdbc.SynchronizeMappings property, the mapping tool provides the default mapping that matches with the database schema automatically. We are not required to run this mapping tool if the default mapping satisfies the necessary database schema.


Examples

To create the database tables needed for the Magazine.java file:

(zos)

(iseries)

To drop the tables for Magazine.java:

(zos)

(iseries)

To validate the mappings for all classes on the class path:

(zos)

(iseries)


Additional information

See the mapping information in the Apache OpenJPA User Guide for more information and examples.

  • Develop JPA 2.x applications for a Java EE environment
  • Develop JPA 2.x applications for a Java SE environment
    Apache OpenJPA User's Guide