Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.0.4, 1.1.0, 1.2.2, 1.2.3, 1.3.0, 2.0.1, 2.0.2, 2.1.0, 2.2.0
-
None
-
None
-
DB2 on z/OS
Description
The problem is by default OpenJPA tries to create tables in the default system database. Most DB2 on z/OS users do not have authority to do this and need their own database and possibly table space to store the data. I had to manually generate the DDL to create the tables using the mapping tool then edit it before running the SQL. For example following is part of the default DDL that was generated.
CREATE TABLE SchemaToUse.Ask (id BIGINT NOT NULL, price DOUBLE, volume INTEGER, version INTEGER, STOCK_SYMBOL VARCHAR(254), TRADE_ID BIGINT, SELLER_NAME VARCHAR(254), PRIMARY KEY (id));
And following is the create table statement I had to use to create the table on z/OS.
CREATE TABLE SchemaToUse.Ask (id BIGINT NOT NULL, price DOUBLE, volume INTEGER, version INTEGER, STOCK_SYMBOL VARCHAR(254), TRADE_ID BIGINT, SELLER_NAME VARCHAR(254), PRIMARY KEY (id)) in databaseName.tablespaceName;
A default index was not created on the primary key so I also had to execute
CREATE UNIQUE INDEX schemaToUse.idx1 ON schemaToUse.Ask (ID ASC);
Also, I could not get the mapping Ant task to work after reading the documentation so had to create a batch file with hard coded paths to run the mapping tool. Adding a schema export target to OpenJPA samples could be a useful addition.