The schema tool can be used to view the database schema in XML form or match an XML schema to an existing database.
Developers may find that they need the wsschema tool for its powerful functions. The wsschema tool can reflect on the current database schema, optionally translating it into an XML representation for further manipulation. Also, the schema tool can take an XML schema definition, calculate the differences between the XML and the existing database schema, and apply the necessary changes to make the databases correspond to the XML schema. The XML format used by the schema tool is abstract from the differences in SQL dialects used by different vendors. The tool also automatically adapts its SQL to meet foreign dependencies, thus the schema tool is useful as a general way to manipulate the schemas.
The command syntax is as follows:
wsschema.sh [parameters][arguments]
wsschema [parameters][arguments]
wsschema.bat [parameters][arguments]
Issue the command from the bin subdirectory of the app_server_root directory.
$ wsschema.sh targetSchema.xml
$ wsschema targetSchema.xml
$ wsschema.bat targetSchema.xml
wsschema.sh -f script.sql targetSchema.xml
wsschema -f script.sql targetSchema.xml
wsschema.bat -f script.sql targetSchema.xml
$ wsschema.sh -a createDB -f script.sql
$ wsschema -a createDB -f script.sql
$ wsschema.bat -a createDB -f script.sql
$ wsschema.sh -a refresh,deleteTableContents
$ wsschema -a refresh,deleteTableContents
$ wsschema.bat -a refresh,deleteTableContents
$ wsschema.sh -a dropDB
$ wsschema -a dropDB
$ wsschema.bat -a dropDB
$ wsschema.sh -a reflect -f schema.xml
$ wsschema -a reflect -f schema.xml
$ wsschema.bat -a reflect -f schema.xml
For more information, refer to chapter 4 JDBC, in the OpenJPA reference documentation.