我的驱动ojdbc14.jar,在hbm.xml文件中如下配置: <property name="content" type="text">
<column name="INTRCONTENT" />
</property>java类中: private String content; public String getContent() {
return content;
} public void setContent(String content) {
this.content= content;
} hibernate配置文件: <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver </property>
<property name="connection.url">jdbc:oracle:thin:@...:1521:... </property>
<property name="connection.username">... </property>
<property name="connection.password">... </property>
<property name="maxActive"><value>10</value></property>
<property name="maxIdle"><value>20</value></property>
<property name="maxWait"><value>120000</value></property>
<property name="defaultAutoCommit"><value>true</value></property><!-- Hibernate SessionFactory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource" />
</property>
<property name="lobHandler" ref="lobHandler" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.jdbc.fetch_size">50</prop>
<prop key="hibernate.jdbc.batch_size">50</prop>
<prop key="hibernate.hbm2ddl.auto">none</prop>
<prop key="hibernate.cache.provider_class">
org.hibernate.cache.HashtableCacheProvider</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.use_minimal_puts">true</prop>
<prop key="hibernate.query.factory_class">
org.hibernate.hql.classic.ClassicQueryTranslatorFactory
</prop>
</props>
</property>
</bean> <bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
我的数据库是10.2 版本的,hibernate3。JDK1.6
存入小一点的数据时,正常,大一点的时候就不成了.2009-07-15 14:18:45,390 [http-8080-6] WARN util.JDBCExceptionReporter (JDBCExceptionReporter.java:71) - SQL Error: 17090, SQLState: null
2009-07-15 14:18:45,390 [http-8080-6] ERROR util.JDBCExceptionReporter (JDBCExceptionReporter.java:72) - 不允许的操作: streams type cannot be used in batching
2009-07-15 14:18:45,406 [http-8080-6] ERROR def.AbstractFlushingEventListener (AbstractFlushingEventListener.java:277) - Could not synchronize database state with session
我用这种方法试了N次还是不行
最后hbm.xml 中用
<property name="content"
type="org.springframework.orm.hibernate3.support.ClobStringType" length="1048576000">
<column name="Content" />
</property>
还是出现 字符在1000 到2000之间报错误 数据库是 oracle 10g高人来解决
在存入大一点的内容时,它存入了空,把以前的内容覆盖了.
如果你的表已经建成,可以先删除,再让它重新创建.不然可能更新不了