APAR status
Closed as program error.
Error description
When using OpenJPA and persisting more than 4000 charaters to an Oracle XMLType the customer sees the following exception: ORA-01461: can bind a LONG value only for insert into a LONG column
Local fix
N/A
Problem summary
**************************************************************** * USERS AFFECTED: All users of the Java Persistence API * * (JPA) 2.0 feature of the IBM WebSphere * * Application Server V7 Feature Pack for * * OSGi Applications and Java Persistence API * * 2.0 who make use Oracle XMLType columns * * and attempt to store more than 4000 * * charaters in the column. * **************************************************************** * PROBLEM DESCRIPTION: Oracle XMLType column failed to * * insert/update when xml contains more * * than 4000 characters. * **************************************************************** * RECOMMENDATION: * **************************************************************** 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 exception is due to the way OpenJPA retrieves the XML data from the Oracle database (that is, it uses a 'getStringVal' method on the JDBC driver).
Problem conclusion
With this fix, code has been added which allows OpenJPA to use a Reader-based JDBC 4.0 method to set XML data. This allows XMLType values larger than 4000 characters to be successfully updated or inserted. There are a number of restrictions for this fix, as will be described now. The code for the fix requires an Oracle JDBC 4.0 level driver (e.g. ojdbc6.jar). Also note that it is not enough to simply get the Oracle JDBC 4 drivers, but the Oracle DB version must also support the JDBC 4 drivers and contain the code to allow XML content greater than 4000 characters (e.g. driver version 11.2.0.1.0). The code changes are gated (enabled/disabled) via a system property. The system property is named 'supportsSetClob' and is defined on OpenJPA's Oracle dictionary class. As an example, the property can be defined as follows in a persistence.xml file: <property name="openjpa.jdbc.DBDictionary" value="oracle(support sSetClob=true)"/> Next, it should be noted that OpenJPA code expects the XML field(s) to be annotated with the following: @Strategy("org.apache.openjpa.jdbc.meta.strats.XMLValueHandler") 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 fix to apply. While an appliation may have 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 the 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 fix. The necessary settings/actions are as follows: First, it may be necessary to annotate an XML field with @Lob, as follows: @Lob @Column(name="CONTENTS_XML", columnDefinition ="XMLCOLUMN XMLTyp e") private String contentsXml; Second, in addition to annotating the XML field with @Lob, a user may also need to set this dictionary property: maxEmbeddedClobSize=-1 Therefore, the final DBDictionary property would be: <property name="openjpa.jdbc.DBDictionary" value="oracle(support sSetClob=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. The fix for this APAR is currently targeted for inclusion in Fix Pack 1.0.0.7 for the Feature Pack for OSGi Applications and Java Persistence API 2.0. Please refer to the recommended updates page for delivery information: http://www.ibm.com/support/docview.wss?rs=180&uid=swg27004980
Temporary fix
Comments
APAR Information
APAR number
PM43675
Reported component name
JPA OSGI FEATUR
Reported component ID
5724J0857
Reported release
700
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2011-07-13
Closed date
2011-09-07
Last modified date
2012-04-19
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fix information
Fixed component name
JPA OSGI FEATUR
Fixed component ID
5724J0857
Applicable component levels
R700 PSY
UP
[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"1.0","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]
Document Information
Modified date:
29 September 2020