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
This commit is contained in:
Albert Lee 2010-10-18 17:48:30 +00:00
parent 60e88f82fa
commit fdf58d63ba
3 changed files with 55 additions and 34 deletions

View File

@ -227,9 +227,15 @@ public class OracleDictionary
if (metadataClassName.startsWith("oracle.") if (metadataClassName.startsWith("oracle.")
|| url.indexOf("jdbc:oracle:") != -1 || url.indexOf("jdbc:oracle:") != -1
|| "Oracle JDBC driver".equals(driverName)) { || "Oracle JDBC driver".equals(driverName)) {
driverVendor = VENDOR_ORACLE + meta.getDriverMajorVersion() int jdbcMajor = meta.getDriverMajorVersion();
+ meta.getDriverMinorVersion(); 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() String productVersion = meta.getDatabaseProductVersion()
.split("Release ",0)[1].split("\\.",0)[0]; .split("Release ",0)[1].split("\\.",0)[0];
int release = Integer.parseInt(productVersion); int release = Integer.parseInt(productVersion);

View File

@ -7,18 +7,18 @@
to you under the Apache License, Version 2.0 (the to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the KIND, either express or implied. See the License for the
specific language governing permissions and limitations specific language governing permissions and limitations
under the License. under the License.
--> -->
<!-- <!--
Maven release plugin requires the project tag to be on a single line. Maven release plugin requires the project tag to be on a single line.
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
@ -268,7 +268,7 @@
<connection.password>${openjpa.sybase.password}</connection.password> <connection.password>${openjpa.sybase.password}</connection.password>
</properties> </properties>
</profile> </profile>
<!-- Profile for testing with Sybase DB using the jConnect driver --> <!-- Profile for testing with Sybase DB using the jConnect driver -->
<profile> <profile>
<id>test-sybase-jconnect</id> <id>test-sybase-jconnect</id>
@ -288,7 +288,7 @@
<connection.password>${openjpa.sybase.password}</connection.password> <connection.password>${openjpa.sybase.password}</connection.password>
</properties> </properties>
</profile> </profile>
<!-- Profile for testing with Ingres DB --> <!-- Profile for testing with Ingres DB -->
<profile> <profile>
<id>test-ingres</id> <id>test-ingres</id>
@ -395,14 +395,14 @@
<connection.password>${openjpa.custom.password}</connection.password> <connection.password>${openjpa.custom.password}</connection.password>
</properties> </properties>
</profile> </profile>
<!-- <!--
The test-custom2 profile does not work very well when used with a The test-custom2 profile does not work very well when used with a
continuous build system. As a convenience I've added profiles for continuous build system. As a convenience I've added profiles for
some of the proprietary databases to make testing easier. some of the proprietary databases to make testing easier.
--> -->
<profile> <profile>
<!-- <!--
Example db2 profile. You can use this profile if you: Example db2 profile. You can use this profile if you:
1) have the DB2 artifacts installed in a local repo and supply 1) have the DB2 artifacts installed in a local repo and supply
the URL: the URL:
@ -411,13 +411,13 @@
commands : commands :
mvn install:install-file -Dfile=${path to db2jcc.jar} \ mvn install:install-file -Dfile=${path to db2jcc.jar} \
-DgroupId=com.ibm.db2 \ -DgroupId=com.ibm.db2 \
-DartifactId=jcc-driver \ -DartifactId=jcc-driver \
-Dversion=9.5 \ -Dversion=9.5 \
-Dpackaging=jar -Dpackaging=jar
mvn install:install-file -Dfile=${path to db2jcc_license.jar} \ mvn install:install-file -Dfile=${path to db2jcc_license.jar} \
-DgroupId=com.ibm.db2 \ -DgroupId=com.ibm.db2 \
-DartifactId=jcc-license \ -DartifactId=jcc-license \
-Dversion=9.5 \ -Dversion=9.5 \
-Dpackaging=jar -Dpackaging=jar
@ -481,7 +481,7 @@
</releases> </releases>
</repository> </repository>
</repositories> </repositories>
</profile> </profile>
<!-- Profile for testing Apache Derby with the DB2 JCC driver --> <!-- Profile for testing Apache Derby with the DB2 JCC driver -->
<profile> <profile>
@ -544,9 +544,9 @@
<!-- Profile for testing Informix with the DB2 JCC driver --> <!-- Profile for testing Informix with the DB2 JCC driver -->
<profile> <profile>
<!-- <!--
Example Informix JCC profile. You can use this profile if you: Example Informix JCC profile. You can use this profile if you:
1a) have the DB2 JCC artifacts installed in a local repo and 1a) have the DB2 JCC artifacts installed in a local repo and
supply the URL: supply the URL:
-Dids.maven.repo=http://my.local.repo -Dids.maven.repo=http://my.local.repo
1b) or have a copy of the DB2 JCC driver and run the commands 1b) or have a copy of the DB2 JCC driver and run the commands
@ -617,7 +617,7 @@
<!-- Profile for testing with Oracle DB --> <!-- Profile for testing with Oracle DB -->
<profile> <profile>
<!-- <!--
Example oracle profile. You can use this profile if you: Example oracle profile. You can use this profile if you:
1) have the Oracle artifacts installed in a local repo and 1) have the Oracle artifacts installed in a local repo and
supply the URL: supply the URL:
@ -626,10 +626,10 @@
command: command:
mvn install:install-file -Dfile=${path to ojdbc.jar} \ mvn install:install-file -Dfile=${path to ojdbc.jar} \
-DgroupId=com.oracle \ -DgroupId=com.oracle \
-DartifactId=jdbc-driver \ -DartifactId=jdbc-driver \
-Dversion=10g \ -Dversion=10g \
-Dpackaging=jar -Dpackaging=jar
You must also set the following properties: You must also set the following properties:
-Dopenjpa.oracle.url -Dopenjpa.oracle.url
-Dopenjpa.oracle.username -Dopenjpa.oracle.username
@ -658,7 +658,7 @@
<oracle.maven.repo>http://not.a.real.repository</oracle.maven.repo> <oracle.maven.repo>http://not.a.real.repository</oracle.maven.repo>
<oracle.groupid>com.oracle</oracle.groupid> <oracle.groupid>com.oracle</oracle.groupid>
<oracle.artifactid>jdbc-driver</oracle.artifactid> <oracle.artifactid>jdbc-driver</oracle.artifactid>
<oracle.version>10g</oracle.version> <oracle.version>11.2.0.1-jdbc6</oracle.version>
<connection.driver.name>oracle.jdbc.driver.OracleDriver</connection.driver.name> <connection.driver.name>oracle.jdbc.driver.OracleDriver</connection.driver.name>
<!--<connection.url>jdbc:oracle:thin:@localhost:1521:OPENJPA</connection.url>--> <!--<connection.url>jdbc:oracle:thin:@localhost:1521:OPENJPA</connection.url>-->
<connection.url>${openjpa.oracle.url}</connection.url> <connection.url>${openjpa.oracle.url}</connection.url>
@ -777,7 +777,7 @@
<execution> <execution>
<phase>process-test-classes</phase> <phase>process-test-classes</phase>
<configuration> <configuration>
<tasks> <tasks>
<ant antfile="src/main/ant/enhancer.xml" target="enhance" inheritRefs="true"> <ant antfile="src/main/ant/enhancer.xml" target="enhance" inheritRefs="true">
<property name="maven.test.skip" value="${maven.test.skip}" /> <property name="maven.test.skip" value="${maven.test.skip}" />
<property name="test" value="${test}" /> <property name="test" value="${test}" />
@ -801,7 +801,7 @@
<configuration> <configuration>
<argLine>${surefire.jvm.args}</argLine> <argLine>${surefire.jvm.args}</argLine>
<excludes> <excludes>
<!-- exclude classes that end with 'Test'; these <!-- exclude classes that end with 'Test'; these
are not test cases per OpenJPA standards --> are not test cases per OpenJPA standards -->
<exclude>org/apache/openjpa/**/*Test.java</exclude> <exclude>org/apache/openjpa/**/*Test.java</exclude>
@ -809,7 +809,7 @@
are not test cases per OpenJPA standards --> are not test cases per OpenJPA standards -->
<exclude>org/apache/openjpa/**/*$*.class</exclude> <exclude>org/apache/openjpa/**/*$*.class</exclude>
<exclude>org/apache/openjpa/**/*.*.class</exclude> <exclude>org/apache/openjpa/**/*.*.class</exclude>
<!-- exclude "no xsd" test until a workaround is figured out (OPENJPA-513) --> <!-- exclude "no xsd" test until a workaround is figured out (OPENJPA-513) -->
<exclude>org/apache/openjpa/persistence/xml/TestPersistenceUnitWithoutXSD.java</exclude> <exclude>org/apache/openjpa/persistence/xml/TestPersistenceUnitWithoutXSD.java</exclude>
@ -964,7 +964,7 @@
<exclude>org/apache/openjpa/persistence/kernel/TestPMMemory.java</exclude> <exclude>org/apache/openjpa/persistence/kernel/TestPMMemory.java</exclude>
<exclude>org/apache/openjpa/persistence/meta/TestExternalValues.java</exclude> <exclude>org/apache/openjpa/persistence/meta/TestExternalValues.java</exclude>
<!-- Exclude subclassing tests --> <!-- Exclude subclassing tests -->
<exclude>org/apache/openjpa/**/TestUnenhanced*.java</exclude> <exclude>org/apache/openjpa/**/TestUnenhanced*.java</exclude>

View File

@ -1139,11 +1139,11 @@ List results = query.getResultList();
<listitem> <listitem>
<para> <para>
The Oracle JDBC driver has significant differences between different versions. The Oracle JDBC driver has significant differences between different versions.
It is important to use the officially supported version of the driver It is important to use the officially supported version of the drivers
(10.2.0.1.0), which is backward compatible with previous versions of the Oracle (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 server. It can be downloaded from
<ulink url="http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc101040.html"> <ulink url="http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html">
http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc101040.html</ulink>. http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html</ulink>.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
@ -1211,7 +1211,22 @@ openjpa.ConnectionRetainMode: always
Mapping persistent attributes to <link linkend="ref_guide_xmlmapping">XML columns</link> requires Mapping persistent attributes to <link linkend="ref_guide_xmlmapping">XML columns</link> requires
a JDBC 4 compliant driver if XML strings are longer than 4000 bytes, as counted in database. a JDBC 4 compliant driver if XML strings are longer than 4000 bytes, as counted in database.
Otherwise an <literal>ORA-01461: can bind a LONG value only for insert into a LONG column</literal> Otherwise an <literal>ORA-01461: can bind a LONG value only for insert into a LONG column</literal>
error may result. error may result. This limitation is removed in Oracle jdbc driver 11.2.0.x.
</para>
</listitem>
<listitem>
<para>
If Oracle dictionary property <literal>MaxEmbeddedBlobSize</literal> or
<literal>MaxEmbeddedClobSize</literal> is set to some limit (i.e. not -1) and embedded collection
with blob/clob attribute is used, a
<literal>"org.apache.openjpa.persistence.ArgumentException:
"x.y.z.EmbedOwner.embedCollection&lt;element:class x.y.z.EmbedValue&gt;"
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"</literal> error may result. To overcome this limitation, either use jdbc driver
11.2.0.x.0 (or later version) or set both <literal>MaxEmbeddedBlobSize</literal> and
<literal>MaxEmbeddedClobSize</literal> oracle dictiionary properties to -1.
</para> </para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>