java.lang.Clob的问题(hibernate,sqlserver2000)

java.lang.Clob的问题(hibernate,sqlserver2000)

News.java里有个字段body,类型为String,对应的数据库为SQL Server2000,字段类型为ntext,使用了hibernate,当body中输入特别长的字符时,出错:
Java code
 
java.sql.SQLException: The amount of data read from the stream is not = length. net.sourceforge.jtds.jdbc.ClobImpl.getSubString(ClobImpl.java:254) net.sourceforge.jtds.jdbc.Support.convert(Support.java:319) net.sourceforge.jtds.jdbc.JtdsResultSet.getString(JtdsResultSet.java:844) net.sourceforge.jtds.jdbc.JtdsResultSet.getString(JtdsResultSet.java:1120) org.hibernate.type.StringType.get(StringType.java:18) org.hibernate.type.NullableType.nullSafeGet(NullableType.java:113) org.hibernate.type.NullableType.nullSafeGet(NullableType.java:102) org.hibernate.type.AbstractType.hydrate(AbstractType.java:81) org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:1899) org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1372) org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1300) org.hibernate.loader.Loader.getRow(Loader.java:1197) org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:569) org.hibernate.loader.Loader.doQuery(Loader.java:689) org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224) org.hibernate.loader.Loader.doList(Loader.java:2145) org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029) org.hibernate.loader.Loader.list(Loader.java:2024) org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375) org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308) org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153) org.hibernate.impl.SessionImpl.list(SessionImpl.java:1106) org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
 
有什么好的解决办法吗?在线等.
将类型改为text,试试看
ntext都小了,何况text
你再看看这个配置文件中applicationContext.xml,设置是不是这样的:
XML code
 
<property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.format_sql">true</prop> <prop key="connection.useUnicode">true</prop> <prop key="connection.characterEncoding">utf-8</prop> <prop key="jdbc.fetch_size">50</prop> <prop key="jdbc.batch_size">0</prop> <prop key="hibernate.use_sql_comments">true</prop> <prop key="hibernate.max_fetch_depth">5</prop> </props> </property>
 

主要看看这几个:
<prop key="jdbc.fetch_size">50 </prop>
<prop key="jdbc.batch_size">0 </prop>

<prop key="hibernate.max_fetch_depth">5 </prop>
问题找到了 <property name="body" column="body"/>
改成 <property name="body" column="body" type="text"/>
要结帖了,分不知道给谁,等等看,楼下准备接分了
但是ntext能支持多少数据量呢 
不懂,up
不懂,up