You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Jeremy Bauer (JIRA)" <ji...@apache.org> on 2008/10/10 15:53:44 UTC

[jira] Created: (OPENJPA-743) OptimisticLockException persisting collection containing Lob fields with Oracle

OptimisticLockException persisting collection containing Lob fields with Oracle
-------------------------------------------------------------------------------

                 Key: OPENJPA-743
                 URL: https://issues.apache.org/jira/browse/OPENJPA-743
             Project: OpenJPA
          Issue Type: Bug
          Components: jdbc
    Affects Versions: 1.2.0
         Environment: OpenJPA 1.2.0, Oracle 10g ojdbc14.jar, version 10.2.0.1.0
            Reporter: Jeremy Bauer
            Assignee: Jeremy Bauer


Persisting an object graph with an entity containing a persistent collection of objects which contain a Lob field may fail on Oracle if statement batching is enabled.  The failure will depend on the order of operations, which can be somewhat intermittent.  If more than one insert into the table containing the Lob column are batched together and there is a mix of null and non-null data value parameters, the batch insert operation will fail with an OptimisticLockException.  

A simple (but not especially performance friendly) way to work around the problem is to disable statement batching via: 
<property name="openjpa.jdbc.DBDictionary" value="oracle(batchLimit=0)"/>  Otherwise, if possible, make sure all Lob fields are set to a non-null value.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (OPENJPA-743) OptimisticLockException persisting collection containing Lob fields with Oracle

Posted by "Jeremy Bauer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-743?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeremy Bauer resolved OPENJPA-743.
----------------------------------

    Resolution: Fixed

When setting up a parameters of a prepared statement, OpenJPA sets null clob field values to an empty clob parameter type, while it sets non-null values to a character stream.  When statement batching is enabled, the Oracle 1.4 driver fails to insert all the batched rows due to using mixed parameter types, even though the parameter types/values are compatible with the table column and can be inserted using separate statements.  

This problem no longer exists in version 11.0.7.0 of the Oracle JDK 5 JDBC driver, ojdbc5.jar.  It was not, however resolved in the latest 1.4 driver, version 10.2.0.4.  Preferably, get the latest  ojdbc5 driver to correct the problem.  If use of ojdbc14.jar is necessary, the recommended workaround is to disable statement batching.

> OptimisticLockException persisting collection containing Lob fields with Oracle
> -------------------------------------------------------------------------------
>
>                 Key: OPENJPA-743
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-743
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 1.2.0
>         Environment: OpenJPA 1.2.0, Oracle 10g ojdbc14.jar, version 10.2.0.1.0
>            Reporter: Jeremy Bauer
>            Assignee: Jeremy Bauer
>
> Persisting an object graph with an entity containing a persistent collection of objects which contain a Lob field may fail on Oracle if statement batching is enabled.  The failure will depend on the order of operations, which can be somewhat intermittent.  If more than one insert into the table containing the Lob column are batched together and there is a mix of null and non-null data value parameters, the batch insert operation will fail with an OptimisticLockException.  
> A simple (but not especially performance friendly) way to work around the problem is to disable statement batching via: 
> <property name="openjpa.jdbc.DBDictionary" value="oracle(batchLimit=0)"/>  Otherwise, if possible, make sure all Lob fields are set to a non-null value.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.