LOB Data Processing
In order to process LOB in iBATIS, jdbcType must be specified as CLOB/BLOB in the part of setting the information about the parameter and result in the SqlMap file.
Otherwise, incorrect data can be entered or incorrect data can be queried by the length limit. Or, an error such as invalid length may occur.
Therefore, mapping for parameter and result must be designated as CLOB/BLOB
The following is an example of setting parameterMap and resultMap for CLOB type data.
Ex) LobSample's LobSample.xml (SqlMap) file
In addition, the important thing to be careful when processing LOB is that in order to process LOB data in Altibase, the transaction must be managed after changing the autocommit mode to false. When setting dataSource in <transactionManager> of SqlMapConfig file when integrating iBATIS, setAutoCommit(false); There is no consideration when processing LOB because the autocommit mode is changed to false by calling the method. However, if iBATIS and Spring are linked together, if the user manages transactions in Spring, the user must specify TransactionManager bean to process LOB.
In addition, in the case of declarative transaction processing in Spring, propagation must be specified as one of PROPAGATION_REQUIRED, PROPAGATION_REQUIRES_NEW, and PROPAGATION_NESTED.
If TransactionManager is not specified or propagation is set to a value other than the above described when using declarative transaction, a null value is returned when querying LOB data, or "java.sql.SQLException: [DOCKI: 0]: An error such as LobLocator can not span the transaction 101858625" occurs.
In addition, when entering LOB data, "java", "java.sql.SQLException: [DOCKI: 0]: An error such as LobLocator can not span the transaction 101858625" occurs.
The following example is an example of processing LOB data by declaratively processing a transaction in Spring's applicationContext.xml.
For more detailed information on how to process transactions declaratively, please refer to the document "Spring Integration Guide for Altibase".
Ex) LobSpringIbatisSample's applicationContext.xml file
To run the LobSpringIbatisSample project above, Altibase.jar, ibatis-2.3.4.x.jar, spring-jdbc.jar, spring.orm.jar, spring.jar, commons-logging,kar, and club-nodep-xx files are needed.