You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by jr...@apache.org on 2009/11/10 18:53:33 UTC

svn commit: r834564 - in /openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/strats/ openjpa-project/src/doc/manual/

Author: jrbauer
Date: Tue Nov 10 17:53:32 2009
New Revision: 834564

URL: http://svn.apache.org/viewvc?rev=834564&view=rev
Log:
OPENJPA-1248 Set null or empty_lob as appropriate when inserting a new streaming lob for update on Oracle.  Also configured test to retain connection over the life of the tx and updated manual to document this requirement.

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/strats/AbstractLobTest.java
    openjpa/trunk/openjpa-project/src/doc/manual/supported_databases.xml

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java?rev=834564&r1=834563&r2=834564&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java (original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java Tue Nov 10 17:53:32 2009
@@ -1161,9 +1161,12 @@
     
     public void insertClobForStreamingLoad(Row row, Column col, Object ob)
         throws SQLException {
-        if (ob == null)
+        if (ob == null) {
             col.setType(Types.OTHER);
-        row.setNull(col);
+            row.setNull(col);
+        } else {
+            row.setClob(col, getEmptyClob());
+        }
     }
 
     public int getBatchUpdateCount(PreparedStatement ps) throws SQLException {
@@ -1202,8 +1205,11 @@
     @Override
     public void insertBlobForStreamingLoad(Row row, Column col, 
         JDBCStore store, Object ob, Select sel) throws SQLException {
-        if (ob == null)
+        if (ob == null) {
             col.setType(Types.OTHER);
-        row.setNull(col);
-    }    
+            row.setNull(col);
+        } else {
+            row.setBlob(col, getEmptyBlob());
+        }
+    }
 }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/strats/AbstractLobTest.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/strats/AbstractLobTest.java?rev=834564&r1=834563&r2=834564&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/strats/AbstractLobTest.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/strats/AbstractLobTest.java Tue Nov 10 17:53:32 2009
@@ -49,7 +49,8 @@
     public void setUp() throws Exception {
         super.setUp(getLobEntityClass(), CLEAR_TABLES,
             "openjpa.DataCache", "true",
-            "openjpa.RemoteCommitProvider", "sjvm");
+            "openjpa.RemoteCommitProvider", "sjvm",
+            "openjpa.ConnectionRetainMode", "transaction");
     }
 
     public boolean isDatabaseSupported() {

Modified: openjpa/trunk/openjpa-project/src/doc/manual/supported_databases.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-project/src/doc/manual/supported_databases.xml?rev=834564&r1=834563&r2=834564&view=diff
==============================================================================
--- openjpa/trunk/openjpa-project/src/doc/manual/supported_databases.xml (original)
+++ openjpa/trunk/openjpa-project/src/doc/manual/supported_databases.xml Tue Nov 10 17:53:32 2009
@@ -1153,6 +1153,26 @@
 CLOB columns cannot be used in queries.
                     </para>
                 </listitem>
+                <listitem>
+                    <para>
+The use of LOBs with persistent attributes of a streaming data type (ex. 
+<literal>java.io.InputStream</literal> or <literal>java.io.Reader</literal>) may 
+require the same connection to be used over the life of the transaction or 
+entity manager.  If the same connection is not used for persistent operations
+a <literal>java.io.IOException</literal> with message <literal>Closed Connection
+</literal> may result.  The OpenJPA property <literal>openjpa.ConnectionRetainMode</literal>
+can be used to control how OpenJPA uses datastore connections.  See 
+<xref linkend="ref_guide_dbsetup_retain"/> for details.
+            <example id="dbsupport_oracle_retain_connection">
+                <title>
+                    Property to retain connection over the lifetime of the entity manager
+                </title>
+<programlisting>
+openjpa.ConnectionRetainMode: always
+</programlisting> 
+            </example>
+                    </para>
+                </listitem>
             </itemizedlist>
         </section>
     </section>