+

Search Tips   |   Advanced Search

wsreversemapping command


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

 

Syntax

Before running the command,  have a copy of persistence.xml on the classpath, or specify  it as a properties file through the -p [path_to_persistence.xml] argument. Issue the  command from the bin subdirectory of the app_install_root directory.

The command syntax is as follows:
[AIX] [HP-UX] [Linux] [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 will not contain annotations. Annotations can be added manually if desired. Messages and errors are logged to the 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.abc: [AIX] [HP-UX] [Linux] [Solaris]

${WAS_HOME}/bin/wsreversemapping.sh -pkg com.abc -d ./src schema.xml

(Windows)

${WAS_HOME}\bin\wsreversemapping.bat -pkg com.abc -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] [HP-UX] [Linux] [Solaris]

C:\> %WAS_HOME%/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:\> %WAS_HOME%\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

See, consult the mapping section in the Apache OpenJPA User's Guide.



 

Related tasks


Develop and packaging JPA applications for a Java SE environment

 

Related


Apache OpenJPA User's Guide: Mapping