1. First, we will introduce the corresponding configurations of hibernate.
For database fields, how do we define HBM. xml and pojo of hibernate, corresponding to blob and clob? We define HBM. XML as follows:
Blob à org. springframework. Orm. hibernate3.support. blobbytearraytype Clob à org. springframework. Orm. hibernate3.support. clobstringtype |
Using the corresponding method above, the corresponding type in pojo is
BlobIt is defined as byte []
ClobIt is defined as string.
The following is the definition in spring. We must provide the following configuration (mentioned earlier ):
<Bean id = "nativejdbcextractor" class = "org. springframework. JDBC. Support. nativejdbc. simplenativejdbcextractor"/> <Bean id = "oraclelobhandler" Class = "org. springframework. JDBC. Support. lob. extends lelobhandler" Lazy-init = "true"> <Property name = "nativejdbcextractor"> <Ref bean = "nativejdbcextractor"/> </Property> </Bean> |
Defines the above oraclelobhandler. We must also inject oraclelobhandler into the sessionfactory of hibernate in spring.