Thanks shorecode - We have yet to find a solution. I got around it initially by removing all \r\n from the string. This appeared to work, however, once I started inserting a different XML string, it started switching them again. Here is my mapping file:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping
>
<class
name="com.presidio.params.PTIDocument"
table="Document"
>
<id
name="documentId"
column="documentId"
type="long"
unsaved-value="-1"
>
<generator class="sequence">
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-PTIDocument.xml
containing the additional parameters and place it in your merge dir.
-->
<param name="sequence">documentId_SEQ</param>
</generator>
</id>
<version
name="version"
type="int"
column="version"
unsaved-value="negative"
/>
<property
name="organizationId"
type="long"
column="organizationId"
/>
<property
name="key1"
type="java.lang.String"
column="key1"
/>
<property
name="key2"
type="java.lang.String"
column="key2"
/>
<property
name="document"
type="text"
column="document"
/>
<property
name="documentName"
type="java.lang.String"
column="documentName"
/>
<property
name="documentType"
type="java.lang.String"
column="documentType"
/>
<property
name="documentOwnerId"
type="long"
column="documentOwnerId"
/>
<property
name="digitalLock"
type="java.lang.String"
column="digitalLock"
/>
<property
name="digitalLockDate"
type="java.lang.String"
column="digitalLockDate"
/>
<property
name="history"
type="text"
column="history"
/>
<property
name="encounterId"
type="java.lang.Long"
column="encounterId"
/>
<property
name="formattedDocument"
type="text"
column="formattedDocument"
/>
<set name="propertyList" table="propertyList" cascade="all" lazy="false">
<key column="documentId"/>
<one-to-many class="com.presidio.params.Property"/>
</set>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-PTIDocument.xml
containing the additional properties and place it in your merge dir.
-->
</class>
</hibernate-mapping>
As you can see, it's pretty straight forward. Nothing special. My getters/setters just get/set a String property. The insert/update is, again, nothing special:
try {
Session session = HibernateUtil.getSession();
HibernateUtil.beginTransaction();
session.save(encounter);
}
catch (Exception ptie) {
throw new PTIHibernateSessionException(PTIException._FATAL, true,
"Unable to save encounter record", ptie);
}
The commit, rollback and session.close are handled outside of the method. That's why they are not there. However, I can walk through my code and the very next statement executed after the save is a commit.
I've turned on log4j and it appears as though it is binding the CLOBs correctly. So, I can't tell if it is somewhere else in hibernate or in the Oracle JDBC layer. I've used this same JDBC driver with Spring and straight JDBC and it works fine. So, I think the involvement of Hibernate here is causing the problem. Anybody else with some thoughts?
Thanks,
Tom