Network Deployment (Distributed operating systems), v8.0 > Reference > Command-line utilities


wsreversemapping command

The wsreversemapping tool generates persistent class definitions and metadata from a database schema.

Before running the command, have a copy of the persistence.xml file 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:

(AIX) (Solaris)

wsreversemapping.sh [parameters][arguments]
(Windows)
wsreversemapping.bat [parameters][arguments]


Parameters

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


Usage

The wsreversemapping tool is used to perform reverse (bottom-up) mappings of database tables to entity source files. This is useful if developers want to generate Java files from a database for use in other JPA applications.

To run this tool:

The generated Java files from the wsreversemapping tool might require some editing before they can be used in an application. Also, generated files do not contain annotations. Annotations can be added manually. Messages and errors are logged to the admin console as specified by the configuration.


Examples

Generate entities based on the information saved in the schema.xml file. Schema.xml was created by running the schema tool. The Java files are created in the src directory and use the package com.xyz:

(AIX) (Solaris)

${PROFILE_ROOT}/bin/wsreversemapping.sh -pkg com.xyz -d ./src schema.xml
(Windows)
${PROFILE_ROOT}\bin\wsreversemapping.bat -pkg com.xyz -d ./src schema.xml

Generate entities based on information in a DB2 database. Entities are created in the src directory, and use the package com.reversemapped:

(AIX) (Solaris)

C:\> %PROFILE_ROOT%/bin/wsreversemapping.bat -sa dropDB Magazine.javapkg com.reversemapped -d src
-connectionDriverName=com.ibm.db2.jcc.DB2Driver -connectionURL=jdbc:db2:localhost:50000/TEST
-connectionUser=db2User -connectionPassword=db2Password
(Windows)
C:\> %PROFILE_ROOT%\bin\wsreversemapping.bat -sa dropDB Magazine.javapkg com.reversemapped -d src
-connectionDriverName=com.ibm.db2.jcc.DB2Driver -connectionURL=jdbc:db2:localhost:50000/TEST
-connectionUser=db2User -connectionPassword=db2Password


Additional information

For more information, read the mapping section in the Apache OpenJPA User Guide.
Develop JPA 2.x applications for a Java SE environment


Related

+

Search Tips   |   Advanced Search