WAS v8.5 > Reference > Command-line utilities

wsreversemapping command

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


Syntax

Before running the command, you must 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:


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 dmgr 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:

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

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 
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.


Reference:

Apache OpenJPA User's Guide


+

Search Tips   |   Advanced Search