[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2089) ClobType.setToXMLNode: could not read XML from Clob

Pietro Iglio (JIRA) noreply at atlassian.com
Thu Sep 27 03:52:57 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2089?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_28235 ] 

Pietro Iglio commented on HHH-2089:
-----------------------------------

Hi, sorry I have other committments and no time to work on the test case. I can tell you that we have built a version of hibernate with this specific fix and we have been using it for many months without problems.
The JDBC spec is quite clear about getSubString (see Clob javadoc), do you really need a unit test?
Please look here:

http://java.sun.com/javase/6/docs/api/java/sql/Clob.html#getSubString(long,%20int)

"pos - the first character of the substring to be extracted. The first character is at position 1."

Hope this helps.

Ciao, Pietro


> ClobType.setToXMLNode: could not read XML from Clob
> ---------------------------------------------------
>
>                 Key: HHH-2089
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2089
>             Project: Hibernate3
>          Issue Type: Patch
>          Components: core
>    Affects Versions: 3.2.0.cr4
>         Environment: Hib 3.2.0cr4, database: any
>            Reporter: Pietro Iglio
>   Original Estimate: 0 minutes
>  Remaining Estimate: 0 minutes
>
> I get "org.hibernate.HibernateException: could not read XML from Clob" trying to retrieve a CLOB column as XML. I think I have found the reason of the bug in org.hibernate.type.ClobType:
> public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory) {
>     ...
>     node.setText( clob.getSubString(0, len) );
>     ...
> }
> According to the JDBC spec, the first character of Clob is at 1 position, so the correct line should be node.setText( clob.getSubString(1, len) );

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list