Wednesday, February 8, 2012 15:52

Mapping Oracle Long and Clob Type in Hibernate

Tagged with:
Posted by on Wednesday, December 17, 2008, 8:07
This news item was posted in Team Fight category and has 0 Comments so far.

Hi All,

It is interesting.

My opinion and investigation:

  1. Oralce strongly recommend not to use LONG datatype in oracle, especially above oracle 8.LONG type is just for backward compatibility.

And the use of LONG datatype is subject to many restrictions.

    1. like Hanjin said, the LONG column cannot appear in WHERE clasuses.
    2. A table can contain only one LONG column , although this is not a problem for us now.
  1. Hibernate doesn’t come with the support of manipulation for CLOB column. It is difficult to deal with those CLOB column.( http://www.hibernate.org/76.html and http://www.hibernate.org/56.html)
    Typically, we can creat a new type to get/set CLOB value.

But dear spring has already invented a wheel – org.springframework.orm.hibernate3.support.ClobStringType.

If interested with it, you can look into its source code.

I checked in the updated codes (***.hbm.xml and applicationContext-hibernate.xml), FYI.

Best regards,

Dan

Attached zip file contains some related articles.

oracle-clob-long-in-hibernate.zip

Leave a Reply

You can leave a response, or trackback from your own site.