[ 
https://issues.apache.org/jira/browse/OPENJPA-1925?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14267629#comment-14267629
 ] 

Gary Shank edited comment on OPENJPA-1925 at 1/7/15 1:45 PM:
-------------------------------------------------------------

I was able to resolve this on my own by creating my own DB2DictionaryZOS class 
that extends OpenJPA's DB2Dictionary and overriding the getCreateTableSQL 
method and altering the default generated SQL to append: " IN 
{database_name}.{tablespace_name}" to all the CREATE TABLE commands.  The 
database_name and tablespace_name variables are user configurable.


was (Author: gshank):
I was able to resolve this on my own by creating my own DB2DictionaryZOS class 
that extends OpenJPA's DB2Dictionary and overriding the getCreateTableSQL 
method and altering the default generated SQL to append:
" IN {database_name}.{tablespace_name}" to all the CREATE TABLE commands.
The database_name and tablespace_name variables are user configurable.

> Mapping tool needs to recognize the use of tablespaces for DB2 on z/OS
> ----------------------------------------------------------------------
>
>                 Key: OPENJPA-1925
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1925
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: tooling
>    Affects Versions: 1.0.4, 1.0.5, 1.1.0, 1.1.1, 1.2.2, 1.2.3, 1.3.0, 2.0.1, 
> 2.0.2, 2.1.0, 2.2.0
>         Environment: DB2 on z/OS
>            Reporter: Kevin Sutter
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to