Return-Path: X-Original-To: apmail-db-ddlutils-dev-archive@www.apache.org Delivered-To: apmail-db-ddlutils-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5FD5A17CCE for ; Fri, 6 Nov 2015 10:53:28 +0000 (UTC) Received: (qmail 89197 invoked by uid 500); 6 Nov 2015 10:53:28 -0000 Delivered-To: apmail-db-ddlutils-dev-archive@db.apache.org Received: (qmail 89133 invoked by uid 500); 6 Nov 2015 10:53:28 -0000 Mailing-List: contact ddlutils-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ddlutils-dev@db.apache.org Delivered-To: mailing list ddlutils-dev@db.apache.org Received: (qmail 89117 invoked by uid 99); 6 Nov 2015 10:53:28 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Nov 2015 10:53:28 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id EB5E72C1F51 for ; Fri, 6 Nov 2015 10:53:27 +0000 (UTC) Date: Fri, 6 Nov 2015 10:53:27 +0000 (UTC) From: "Antonio Robirosa (JIRA)" To: ddlutils-dev@db.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (DDLUTILS-289) Support for rowid column type in Oracle MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Antonio Robirosa created DDLUTILS-289: ----------------------------------------- Summary: Support for rowid column type in Oracle Key: DDLUTILS-289 URL: https://issues.apache.org/jira/browse/DDLUTILS-289 Project: DdlUtils Issue Type: Improvement Components: Core - Oracle Affects Versions: 1.0 Environment: Ubuntu Oracle Database 11g Release 11.2.0.4.0 - 64bit Production dbDriverVersion: Oracle JDBC driver : 12.1.0.2.0 Reporter: Antonio Robirosa Assignee: Thomas Dudziak h2. Description Allow DDL Utils to read tables which contain columns with the rowid data type. h2. Benefits DDL Utils can be used in Oracle databases which contains materialized views with fast refresh -which required rowids-. h2. Proposed change To add a custom one-way mapping to the row id column type in the class Oracle8Platform to allow reading the information of thecolumns. {code} diff --git a/src/java/org/apache/ddlutils/platform/oracle/Oracle8Platform.java.original b/src/java/org/apache/ddlutils/platform/oracle/Oracle8Platform.java index c0e2378..b1932bf 100644 --- a/src/java/org/apache/ddlutils/platform/oracle/Oracle8Platform.java.original +++ b/src/java/org/apache/ddlutils/platform/oracle/Oracle8Platform.java @@ -81,6 +81,7 @@ public class Oracle8Platform extends PlatformImplBase info.addNativeTypeMapping(Types.TINYINT, "NUMBER(3)"); info.addNativeTypeMapping(Types.VARBINARY, "RAW"); info.addNativeTypeMapping(Types.VARCHAR, "VARCHAR2"); + info.addNativeTypeMapping(Types.ROWID, "BLOB"); info.addNativeTypeMapping("BOOLEAN", "NUMBER(1)", "BIT"); info.addNativeTypeMapping("DATALINK", "BLOB", "BLOB"); {code} h2. Current Situation I am currently working on eCommerce Project with a eCommerce Suite which uses DDL Utils and we receive the following error when tables with rowid columns in the database exist: {code} INFO | jvm 1 | main | 2015/11/05 17:50:04.153 | org.apache.ddlutils.model.ModelException: Unknown JDBC type code -8 INFO | jvm 1 | main | 2015/11/05 17:50:04.153 | at org.apache.ddlutils.model.Column.setTypeCode(Column.java:215) INFO | jvm 1 | main | 2015/11/05 17:50:04.153 | at org.apache.ddlutils.platform.JdbcModelReader.readColumn(JdbcModelReader.java:781) INFO | jvm 1 | main | 2015/11/05 17:50:04.153 | at org.apache.ddlutils.platform.oracle.Oracle8ModelReader.readColumn(Oracle8ModelReader.java:117) {code} h2. Example for the tests The materialized view proposed on this article [The Trouble with Triggers|http://www.oracle.com/technetwork/testcontent/o58asktom-101055.html] must work with DDL utils: {code} SQL> create table primary_currency ( country varchar2(2) primary key, currency varchar2(3) ) / Table created. SQL> create table other_currencies ( country varchar2(2), currency varchar2(3), constraint other_currencies_pk primary key(country,currency) ) / Table created. SQL> alter table other_currencies add constraint must_have_at_least_one_primary foreign key(country) references primary_currency(country) / Table altered. SQL> create materialized view log on primary_currency with rowid / Materialized view log created. SQL> create materialized view log on other_currencies with rowid / Mat erialized view log created. SQL> create materialized view primary_is_not_other refresh fast on commit as select a.rowid arid, b.rowid brid from primary_currency a, other_currencies b where a.country = b.country and a.currency = b.currency / Materialized view created. SQL> alter table primary_is_not_other add constraint primary_curr_cannot_be_other check (arid is null and brid is null) / Table altered. {code} The view is created by Oracle with the type Table. -- This message was sent by Atlassian JIRA (v6.3.4#6332)