-----------------------------------------------------------------------------------------------
JPA (Sun persistence standard)==> Persistence Provider (Toplink) ==> JDBC (version 11.)
1) JPA provides a simple solution for persisting LOB in Database. Developer only need to annotate the Entity variable that is a LOB. Looks like that, at least from the document, that I have read.
2) However, persistence manager seems cannot persist a string bigger than 4000 byte. Why?
//------------------------------------------------------------------------------------------------
The reason is that the JDBC driver, I am using, ojdbc14.jar, which is only compatible for jdk1.4 not for jdk1.5. It doesn't support write BLOB into database just like writing in a String. So I download the latest version JDBC driver, ojdbc5.jar, and problem solved at once.
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
JDBC driver: ojdbc14.
- Specification-Title: "Oracle JDBC driver classes for use with JDK1.4"
- Specification-Version: "Oracle JDBC Driver version - 9.0.2.0.0"
JDBC driver 10.2 above, it can treat Clob as if they were strings, with code like:
ps = conn.createPreparedStatement( "update tab set lob =?");
ps.setString(1,"Bob")
The actual way this is done internally depends on the size of String set on the bind-parameter.
Better performance can be squeezed out of this for String between 4000 bytes and 32Kb, using a bit of PL/SQL:
ps = conn.prepareStatement("begin \n
update tab set lob= ? where id = ?;\n
End;")
Ps.setString(1, StringUpTo32K);