From fdf58d63ba0f7bf1c844e4b5da3fb904b90cf546 Mon Sep 17 00:00:00 2001 From: Albert Lee Date: Mon, 18 Oct 2010 17:48:30 +0000 Subject: [PATCH] OPENJPA-1837 - reset Oracle dictionary maxEmbedded*lobSize = -1 for jdbc driver (11.2.0.x) that can handle *lob size > 4000 characters. git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1023925 13f79535-47bb-0310-9956-ffa450edef68 --- .../openjpa/jdbc/sql/OracleDictionary.java | 10 +++- openjpa-persistence-jdbc/pom.xml | 54 +++++++++---------- .../src/doc/manual/supported_databases.xml | 25 +++++++-- 3 files changed, 55 insertions(+), 34 deletions(-) diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java index 1115e1854..64087f966 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java @@ -227,9 +227,15 @@ public class OracleDictionary if (metadataClassName.startsWith("oracle.") || url.indexOf("jdbc:oracle:") != -1 || "Oracle JDBC driver".equals(driverName)) { - driverVendor = VENDOR_ORACLE + meta.getDriverMajorVersion() - + meta.getDriverMinorVersion(); + int jdbcMajor = meta.getDriverMajorVersion(); + int jdbcMinor = meta.getDriverMinorVersion(); + driverVendor = VENDOR_ORACLE + jdbcMajor + jdbcMinor; + int jdbcVersion = jdbcMajor * 1000 + jdbcMinor; + if( jdbcVersion >= 11002) { + maxEmbeddedBlobSize = -1; + maxEmbeddedClobSize = -1; + } String productVersion = meta.getDatabaseProductVersion() .split("Release ",0)[1].split("\\.",0)[0]; int release = Integer.parseInt(productVersion); diff --git a/openjpa-persistence-jdbc/pom.xml b/openjpa-persistence-jdbc/pom.xml index 4645b8c3e..9280871df 100644 --- a/openjpa-persistence-jdbc/pom.xml +++ b/openjpa-persistence-jdbc/pom.xml @@ -7,18 +7,18 @@ to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations - under the License. + under the License. --> - @@ -268,7 +268,7 @@ ${openjpa.sybase.password} - + test-sybase-jconnect @@ -288,7 +288,7 @@ ${openjpa.sybase.password} - + test-ingres @@ -395,14 +395,14 @@ ${openjpa.custom.password} - - - @@ -544,9 +544,9 @@ - - ${openjpa.oracle.url} @@ -777,7 +777,7 @@ process-test-classes - + @@ -801,7 +801,7 @@ ${surefire.jvm.args} - org/apache/openjpa/**/*Test.java @@ -809,7 +809,7 @@ are not test cases per OpenJPA standards --> org/apache/openjpa/**/*$*.class org/apache/openjpa/**/*.*.class - + org/apache/openjpa/persistence/xml/TestPersistenceUnitWithoutXSD.java @@ -964,7 +964,7 @@ org/apache/openjpa/persistence/kernel/TestPMMemory.java org/apache/openjpa/persistence/meta/TestExternalValues.java - + org/apache/openjpa/**/TestUnenhanced*.java diff --git a/openjpa-project/src/doc/manual/supported_databases.xml b/openjpa-project/src/doc/manual/supported_databases.xml index aaaa0a246..a15905057 100644 --- a/openjpa-project/src/doc/manual/supported_databases.xml +++ b/openjpa-project/src/doc/manual/supported_databases.xml @@ -1139,11 +1139,11 @@ List results = query.getResultList(); The Oracle JDBC driver has significant differences between different versions. -It is important to use the officially supported version of the driver -(10.2.0.1.0), which is backward compatible with previous versions of the Oracle +It is important to use the officially supported version of the drivers +(10.2.0.1.0/11.2.0.x.0), which is backward compatible with previous versions of the Oracle server. It can be downloaded from - -http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc101040.html. + +http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html. @@ -1211,7 +1211,22 @@ openjpa.ConnectionRetainMode: always Mapping persistent attributes to XML columns requires a JDBC 4 compliant driver if XML strings are longer than 4000 bytes, as counted in database. Otherwise an ORA-01461: can bind a LONG value only for insert into a LONG column -error may result. +error may result. This limitation is removed in Oracle jdbc driver 11.2.0.x. + + + + +If Oracle dictionary property MaxEmbeddedBlobSize or +MaxEmbeddedClobSize is set to some limit (i.e. not -1) and embedded collection +with blob/clob attribute is used, a +"org.apache.openjpa.persistence.ArgumentException: +"x.y.z.EmbedOwner.embedCollection<element:class x.y.z.EmbedValue>" +is mapped as embedded, but embedded field +"x.y.z.EmbedOwner.embedCollection.x.y.z.EmbedValue.blob" is not embeddable. +Embedded element/key/value types are limited to simple fields and direct relations to other +persistent types" error may result. To overcome this limitation, either use jdbc driver +11.2.0.x.0 (or later version) or set both MaxEmbeddedBlobSize and +MaxEmbeddedClobSize oracle dictiionary properties to -1.