hibernate操作oracle clob字段

数据库驱动为10g的驱动,就可以像操作STRING一样操作CLOB了
HIBERNATE配置加一行:
<property name="hibernate.connection.SetBigStringTryClob">true</property>
HIBERNATE映射CLOB字段写为:
        <property name="content" type="text">
            <column name="CONTENT" />
        </property>
持久化类属性为STRING
<bean id="hibernateProperties"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<props>
<prop key="hibernate.dialect">
${hibernate.dialect}
</prop>
<prop key="hibernate.transaction.factory_class">
${hibernate.transaction.factory_class}
</prop>
<prop key="hibernate.query.factory_class">
${hibernate.query.factory_class}
</prop>
<prop key="hibernate.jdbc.fetch_size">
${hibernate.jdbc.fetch_size}
</prop>
<prop key="hibernate.jdbc.batch_size">
${hibernate.jdbc.batch_size}
</prop>
<prop key="hibernate.connection.pool_size">
${hibernate.connection.pool_size}
</prop>
<prop key="hibernate.statement_cache.size">
${hibernate.statement_cache.size}
</prop>
<prop key="hibernate.maxActive">
${hibernate.maxActive}
</prop>
<prop key="hibernate.maxIdle">
${hibernate.maxIdle}
</prop>
<prop key="hibernate.show_sql">
${hibernate.show_sql}
</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.provider_class">
org.hibernate.cache.EhCacheProvider
</prop>
                <prop key="hibernate.connection.SetBigStringTryClob">true</prop>
</props>
</property>
</bean>

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class dynamic-insert="true" dynamic-update="true" lazy="false"
name="com.bb2c.product.model.ProductDetail" table="TB_PRODUCT_DETAIL">
<id name="prodId" column="PROD_ID" unsaved-value="null">
<generator class="assigned" />
</id>
<property name="prodDesc" column="PROD_DESC" type="text"></property>
</class>
</hibernate-mapping>

你可能感兴趣的:(oracle,sql,Hibernate,jdbc,cache)