Author: hthomann
Date: Tue Feb 2 03:54:33 2016
New Revision: 1728039
URL: http://svn.apache.org/viewvc?rev=1728039&view=rev
Log:
OPENJPA-2627: Create an option to disable column type checking errors during
schema validation.
Modified:
openjpa/trunk/ (props changed)
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_dbsetup.xml
Propchange: openjpa/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 2 03:54:33 2016
@@ -2,5 +2,5 @@
/openjpa/branches/2.0.x:1504611
/openjpa/branches/2.1.x:1415379,1415398,1485010,1513249,1517838,1530146,1533218,1533280,1539188,1569528,1575444,1591536,1636464,1655218,1662610,1673300,1673491,1686894,1709201,1709309
/openjpa/branches/2.2.1.x:1415367,1415413,1415425,1504719,1508186,1530347,1533222,1539193,1651808,1686910
-/openjpa/branches/2.2.x:1384400,1415459-1415460,1415469,1485013,1530364,1533223,1580898,1580939,1591681,1631786,1641906,1642555,1666312,1686911,1700884,1702143
+/openjpa/branches/2.2.x:1384400,1415459-1415460,1415469,1485013,1530364,1533223,1580898,1580939,1591681,1631786,1641906,1642555,1666312,1686911,1700884,1702143,1728038
/openjpa/branches/2.3.x:1533462,1535560,1536912,1540277,1564121
Modified:
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java
URL:
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java?rev=1728039&r1=1728038&r2=1728039&view=diff
==============================================================================
---
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java
(original)
+++
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java
Tue Feb 2 03:54:33 2016
@@ -772,7 +772,7 @@ public abstract class MappingInfo
// can't adapt, else warn and change the existing column type
Message msg = _loc.get(prefix + "-bad-col", context,
Schemas.getJDBCName(type), col.getDescription());
- if (!adapt)
+ if (!adapt && !dict.disableSchemaFactoryColumnTypeErrors)
throw new MetaDataException(msg);
Log log = repos.getLog();
if (log.isWarnEnabled())
Modified:
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
URL:
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java?rev=1728039&r1=1728038&r2=1728039&view=diff
==============================================================================
---
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
(original)
+++
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
Tue Feb 2 03:54:33 2016
@@ -219,6 +219,7 @@ public class DBDictionary
public String schemaCase = SCHEMA_CASE_UPPER;
public boolean setStringRightTruncationOn = true;
public boolean fullResultCollectionInOrderByRelation = false;
+ public boolean disableSchemaFactoryColumnTypeErrors = false; //OPENJPA-2627
// sql
public boolean disableAlterSeqenceIncrementBy=false;
Modified: openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_dbsetup.xml
URL:
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_dbsetup.xml?rev=1728039&r1=1728038&r2=1728039&view=diff
==============================================================================
--- openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_dbsetup.xml
(original)
+++ openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_dbsetup.xml Tue Feb
2 03:54:33 2016
@@ -1573,6 +1573,25 @@ that the entities defined sequence is ke
database. Defaults to false.
</para>
</listitem>
+ <listitem
id="DBDictionary.DisableSchemaFactoryColumnTypeErrors">
+ <para>
+ <indexterm>
+ <primary>
+ schema
+ </primary>
+ <secondary>
+ DisableSchemaFactoryColumnTypeErrors
+ </secondary>
+ </indexterm>
+<literal>DisableSchemaFactoryColumnTypeErrors</literal>: When something other
than the default
+SchemaFactory is used, up-front mapping validation is performed against the
database schema. As
+part of the validation, OpenJPA will verify a persistence class column's type
against the column type
+defined in the database schema. If a mismatch is found, OpenJPA will throw an
exception to flag the
+mismatch types and will not allow processing to continue. This can be
limiting, especially if the
+JDBC driver and/or database can properly handle the mismatch. Set this
property to true to disable
+column type mismatch errors. Defaults to false.
+ </para>
+ </listitem>
<listitem id="DBDictionary.DistinctCountColumnSeparator">
<para>
<indexterm>