The command allows users to utilize the pureQuery feature in Java Persistence API (JPA) applications.
The Feature Pack
for OSGi Applications and JPA 2.0 introduces support for Apache OpenJPA
2.0.
This command has been renamed wsdbgen for the Feature Pack for OSGi Applications and JPA 2.0 and later releases. The command is used in the same way as the wsdb2gen command. The command, wsdb2gen, which implies for DB2® only, works only for DB2 database in WebSphere® Application Server Version 7.0. In the Feature Pack, this command can be used for DB2, Informix® and Oracle databases. Because of that, a synonym, wsdbgen command, is introduced.
Run the JPA commands (.bat on Windows® or .sh on UNIX®) from the <profile_home>/bin directory, rather than from the <app_server_root>/bin directory to make sure you have the latest version of the commands for your release level.
The command syntax is as follows:
wsdbgen.sh [parameters]
wsdbgen.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.
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.
DB2
wsdbgen.sh -pu payroll -collection prod1 -url jdbc:db2://myhostname:50000/proddb -user produser -pw secret
wsdbgen.bat -pu payroll -collection prod1 -url jdbc:db2:\\myhostname:50000\proddb -user produser -pw secret
Informix
wsdbgen.sh -pu payroll -collection prod1 -url jdbc:ids://myhostname:9089/proddb -user produser -pw secret
wsdbgen.bat -pu payroll -collection prod1 -url jdbc:ids:\\myhostname:9089\proddb -user produser -pw secret