Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.0
-
None
-
Ubuntu
Oracle Database 11g Release 11.2.0.4.0 - 64bit Production
dbDriverVersion: Oracle JDBC driver : 12.1.0.2.0
-
Patch
Description
Description
Allow DDL Utils to read tables which contain columns with the rowid data type.
Benefits
DDL Utils can be used in Oracle databases which contains materialized views with fast refresh which required rowids.
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.
diff --git a/src/java/org/apache/ddlutils/model/TypeMap.java b/src/java/org/apache/ddlutils/model/TypeMap.java index 23b4b65..d7d930b 100644 --- a/src/java/org/apache/ddlutils/model/TypeMap.java +++ b/src/java/org/apache/ddlutils/model/TypeMap.java @@ -132,6 +132,7 @@ public abstract class TypeMap registerJdbcType(Types.TINYINT, TINYINT, JdbcTypeCategoryEnum.NUMERIC); registerJdbcType(Types.VARBINARY, VARBINARY, JdbcTypeCategoryEnum.BINARY); registerJdbcType(Types.VARCHAR, VARCHAR, JdbcTypeCategoryEnum.TEXTUAL); + registerJdbcType(Types.ROWID, OTHER, JdbcTypeCategoryEnum.OTHER); // only available in JDK 1.4 and above: if (Jdbc3Utils.supportsJava14JdbcTypes())
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:
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)
Example for the tests
The materialized view proposed on this article The Trouble with Triggers must work with DDL utils:
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.
The view is created by Oracle with the type Table.