openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Heath Thomann (JIRA)" <>
Subject [jira] [Commented] (OPENJPA-1691) Oracle XMLType column failed to insert/update when xml contains more than 4000 characters
Date Wed, 17 Aug 2011 16:28:27 GMT


Heath Thomann commented on OPENJPA-1691:

I'd like to add a few more details about the code changes made to 1.2.x and 2.0.x.  These
details are in addition to the previous (and vitally important) details added by Jeremy. 
In addition to his requirements, it should be noted that the code changes made in this JIRA
are gated (enabled/disabled) via a system property.  The system property is named 'supportsSetClob'
and is defined on the Oracle dictionary class.  As an example, the property can be defined
as follows:

<property name="openjpa.jdbc.DBDictionary" value="oracle(supportsSetClob=true)"/>           

Next, it should be noted that we expect the XML field(s) to be annotated with:                 
This allows a user to indicate that OpenJPA should use JAXB classmetadata to perform the to/from
database value retrieval and storage.  In addition, using this strategy indicates there is
an XMLType used to store the value in the database.  Instead, we've seen customers
attempt to managing their own XML string, mapped to a string field, and expect the code changes
of this JIRA to apply.  While a user has an XMLType specified in the column definition, OpenJPA
cannot count on this data to detect whether the column is really an XML column in the database
(the table could have been created manually with separate DDL instead of using OpenJPA's mapping tool).  
In this case, where the user is doing their own String mapping rather than using the XMLValueHandler,
there are some additional settings a user may need to set/enable in order to resolve the issue
addressed in this JIRA.  The necessary settings/actions are as follows:

First, it may be necessary to annotate an XML field with @Lob, as follows:                                                        
@Column(name="CONTENTS_XML", columnDefinition ="XMLCOLUMN XMLType") 
private String contentsXml;                                            
Second, in addition to annotating the XML field with @Lob, a user may also need to set this dictionary property:                                                               
Therefore, the final DBDictionary property would be:
<property name="openjpa.jdbc.DBDictionary" value="oracle(supportsSetClob=true,maxEmbeddedClobSize=-1)"/>           
Finally, a user may need to use the native schema factory to pick up the XMLType from the database,
that property is as follows:                
<property name="openjpa.jdbc.SchemaFactory" value="native"/>            

By enabling OpenJPA's native schema factory, the database column type can be detected
as XMLType.

> Oracle XMLType column failed to insert/update when xml contains more than 4000 characters
> -----------------------------------------------------------------------------------------
>                 Key: OPENJPA-1691
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 1.2.2, 2.0.0, 2.0.1
>         Environment: Oracle 10g, JDBC driver (ojdbc14.jar), OpenJPA 1.2.2
>            Reporter: Kelvin Law
>            Assignee: Milosz Tylenda
>              Labels: openjpa, oracle, xmltype
>             Fix For: 1.2.3, 1.3.0, 2.0.2, 2.1.0
>         Attachments: OPENJPA-1691.1.2.x.patch, OPENJPA-1691_2.0.x.patch
> Oracle throws the following exception when XML content is greater than 4000 characters:
> ORA-01461: can bind a LONG value only for insert into a LONG column

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message