title: Oracle Clob Reader issue: Protocol violation
body: <p>I'm Using java7, jboss7, ojdbc7,hibernate 4.
  Table has a CLOB column and in domain class the code is something like this:</p>
  
  <p>@Lob
  private String MyClob;</p>
  
  <p>I'm getting this strange error while querying and this is not consistent.</p>
  
  <pre><code>Caused by: javax.persistence.PersistenceException: org.hibernate.HibernateException: IOException occurred reading text
          at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387)
          at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310)
          at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:273)
          at org.hibernate.ejb.criteria.CriteriaQueryCompiler$3.getResultList(CriteriaQueryCompiler.java:254)
          ...
          ... 102 more
  Caused by: org.hibernate.HibernateException: IOException occurred reading text
          at org.hibernate.type.descriptor.java.DataHelper.extractString(DataHelper.java:94)
          at org.hibernate.type.descriptor.java.DataHelper.extractString(DataHelper.java:280)
          at org.hibernate.type.descriptor.java.StringTypeDescriptor.wrap(StringTypeDescriptor.java:89)
          at org.hibernate.type.descriptor.java.StringTypeDescriptor.wrap(StringTypeDescriptor.java:39)
          at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$1.doExtract(ClobTypeDescriptor.java:60)
          at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64)
          at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:261)
          at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:257)
          at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:247)
          at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:332)
          at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2912)
          at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1672)
          at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1604)
          at org.hibernate.loader.Loader.getRow(Loader.java:1504)
          at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:712)
          at org.hibernate.loader.Loader.processResultSet(Loader.java:942)
          at org.hibernate.loader.Loader.doQuery(Loader.java:910)
          at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:341)
          at org.hibernate.loader.Loader.doList(Loader.java:2522)
          at org.hibernate.loader.Loader.doList(Loader.java:2508)
          at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2338)
          at org.hibernate.loader.Loader.list(Loader.java:2333)
          at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:490)
          at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:355)
          at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:195)
          at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1269)
          at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101)
          at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:264)
          ... 104 more
  Caused by: java.io.IOException: Protocol violation: [ 14, 47, ]
          at oracle.jdbc.driver.OracleClobReader.needChars(OracleClobReader.java:264)
          at oracle.jdbc.driver.OracleClobReader.read(OracleClobReader.java:195)
          at org.hibernate.type.descriptor.java.DataHelper.extractString(DataHelper.java:86)
          ... 131 more
  Caused by: java.sql.SQLException: Protocol violation: [ 14, 47, ]
          at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:669)
          at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:249)
          at oracle.jdbc.driver.T4C8TTIClob.read(T4C8TTIClob.java:245)
          at oracle.jdbc.driver.T4CConnection.getChars(T4CConnection.java:3901)
          at oracle.sql.CLOB.getChars(CLOB.java:517)
          at oracle.jdbc.driver.OracleClobReader.needChars(OracleClobReader.java:245)
  </code></pre>