wsdb2gen command

The command allows users to utilize the pureQuery feature in Java™ Persistence API (JPA) applications.

Run the JPA commands (.bat on Windows or .sh on UNIX) from the <WAS_HOME>/bin directory.

Syntax

The command syntax is as follows:

[AIX] [HP-UX] [Linux] [Solaris]
wsdb2gen.sh [parameters]
[Windows]
wsdb2gen.bat [parameters]

Before running the command, your persistence.xml file must be in the META-INF directory and the META-INF directory must be in the class path.

Parameters

  • -help : This parameter displays the help information.
  • -pu : The name of the persistence unit defined in persistence.xml file.
  • -collection : The collection-id which is assigned to package names. The default is NULLID.
  • -url : The URL of the target database. This is used to validate the generated SQL. A URL must be specified either in the persistence.xml file or as a command option. If both are specified, the URL that is specified in the command option is used.
  • -user : The user ID
  • -pw : The corresponding password to connect to target database. If this parameter is not specified, the value found in the persistence.xml file is used.
  • -package : If this parameter is specified, the -package parameter takes the string value package name and a single database package with the specified name is generated. If the -package parameter is not specified, then one package is generated for each entity class. The name consists of seven or fewer letters. For each entity class, the first seven characters of the entity class is used for the package name. If the first seven characters are not unique, then the package name is changed to create a unique name.

Usage

The persistence.xml file must be included in the application Java archive (JAR) file and is also used as input in the DB2® bind to create the DB2 package. The command requires a connection to a database in order to validate generated SQL. The database does not have to be the same as the run time database, but it should be at the same version and release level.

Ensure the following JAR files are on the class path:
  • pdq.jar
  • pdqmgmt.jar
  • db2jcc.jar
  • db2jcc_licence_cu.jar.
If the database URL specifies a DB2 for zOS database, then the following JAR file must also be on the class path: db2jcc_licence_cisuz.jar.
Attention: Read more about the DB2 JAR level compliance for pureQuery at the IBM Support Website: System requirements for IBM Optim pureQuery Runtime for Linux, UNIX, and Windows.
Attention: You can review information about pureQuery StaticBinder in the Data Studio Information Center by reading the topic, "The pureQuery StaticBinder utility."

Run the command from the <WAS_HOME> directory.

Examples

[AIX] [HP-UX] [Linux] [Solaris]
wsdb2gen.sh  -pu payroll -collection prod1 -url jdbc:db2://myhostname:50000/proddb  -user produser -pw secret 
[Windows]
wsdb2gen.bat  -pu payroll -collection prod1 -url jdbc:db2:\\myhostname:50000\proddb  -user produser -pw secret 



Related tasks
Developing JPA and packaging applications for a Java EE environment
Developing and packaging JPA applications for a Java SE environment
Configuring JDBC providers to use pureQuery to access DB2
Configuring data source JDBC providers to use pureQuery in a Java SE environment
Related information
System requirements for IBM Optim pureQuery Runtime for Linux, UNIX, and Windows
The pureQuery StaticBinder utility
Reference topic    

Terms of Use | Feedback

Last updated: Oct 21, 2010 1:44:59 AM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=compass&product=was-express-dist&topic=rejb_wsdb2gen
File name: rejb_wsdb2gen.html