You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by ht...@apache.org on 2016/02/02 04:51:55 UTC

svn commit: r1728038 - in /openjpa/branches/2.2.x: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java openjpa-project/src/doc/manual/ref_guide_dbsetup.xml

Author: hthomann
Date: Tue Feb  2 03:51:55 2016
New Revision: 1728038

URL: http://svn.apache.org/viewvc?rev=1728038&view=rev
Log:
OPENJPA-2627: Create an option to disable column type checking errors during schema validation.

Modified:
    openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java
    openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
    openjpa/branches/2.2.x/openjpa-project/src/doc/manual/ref_guide_dbsetup.xml

Modified: openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java?rev=1728038&r1=1728037&r2=1728038&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java (original)
+++ openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java Tue Feb  2 03:51:55 2016
@@ -771,7 +771,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/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java?rev=1728038&r1=1728037&r2=1728038&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java (original)
+++ openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java Tue Feb  2 03:51:55 2016
@@ -216,6 +216,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/branches/2.2.x/openjpa-project/src/doc/manual/ref_guide_dbsetup.xml
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-project/src/doc/manual/ref_guide_dbsetup.xml?rev=1728038&r1=1728037&r2=1728038&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-project/src/doc/manual/ref_guide_dbsetup.xml (original)
+++ openjpa/branches/2.2.x/openjpa-project/src/doc/manual/ref_guide_dbsetup.xml Tue Feb  2 03:51:55 2016
@@ -1526,6 +1526,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>