June 03, 2004

Clobbered

The title of this entry doesn't refer to my recent bike crash, but rather to an annoying problem that we have faced when creating applications that use an Oracle based object persistence technology. When I built the Virtual Gallery system I used Java Data Objects with Oracle as the host database. Unfortunately, I found a limit of 4000 characters on Character Large Object fields (CLOB). JDO offered no reliable way of getting around this. I quickly settled on a rather inelegant solution, creating my own TextField class that would split large bodies of text into 4000 character chunks and store them in a collection.

Why is this of interest now? BlogBuilder is being built using a similar approach, this time with the Hibernate persistance system on top of Oracle. Again we have the clob problem. Rather than just creating a hack like mine, Kieran is looking for a proper solution to this bug/feature in Hibernate.

For now, however, there is a 4000 character limit on the size of entries, which is why my next entry is split into 2 (or more) sections.


- 5 comments by 3 or more people Not publicly viewable

  1. Why didn't you just use a BLOB instead of a CLOB?

    03 Jun 2004, 12:34

  2. Chris May

    I think (Kieran may correct me) that the original motivation for using a CLOB is that you can fiddle with the data directly in the DB, which makes / made development and testing much easier. Also you can map straight from a CLOB to a java String, whereas a BLOB only gives you an inputstream to read from, or something like that.
    But I think that we will have to switch to using BLOBS before long.

    03 Jun 2004, 13:09

  3. LiDO 2 (which I've now started using) makes it much easier to map between Java and SQL data types using an XML mapping descriptor file.

    03 Jun 2004, 14:28

  4. A clob also means you can do searches of the text very easily.

    03 Jun 2004, 14:51

  5. Robert O'Toole

    Do you need to do that in Oracle, or does Hibernate have a query method for it? I don't think JDO has any way of doing that.

    03 Jun 2004, 15:38


Add a comment

You are not allowed to comment on this entry as it has restricted commenting permissions.