title: error when merge using hibernate 3 and ojdbc 7
body: <p>I get an error when I save my entity using the <code>merge()</code> method from <code>EntityManager</code>. This issue happens when I use Hibernate 3 combined with <code>ojdbc7 12.1.0.2.0 JDBC 4.1</code>, but if I change to <code>ojdbc6 11.2.0.3.0 JDBC 4.0</code> this error will disappear. Can anyone help to resolve my problem, because I need to use <code>ojdbc7</code>.</p>
  
  <pre><code>&gt;[2017-03-30 14:52:42.184]: ERROR - TransactionAspectSupport.completeTransactionAfterThrowing(408) | Application exception overridden by rollback exception
  org.springframework.orm.jpa.JpaSystemException: org.hibernate.exception.GenericJDBCException: could not load an entity: [com.mycomp.casa.persistence.model.CustomerAccountOpening#554]; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not load an entity: [com.mycomp.casa.persistence.model.CustomerAccountOpening#554]
      at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:321)
      at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:404)
      at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:58)
      at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213)
      at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:163)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)
      Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not load an entity: [com.mycomp.casa.persistence.model.CustomerAccountOpening#554]
      at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1214)
      at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1147)
      at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1153)
      at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:695)
      at sun.reflect.GeneratedMethodAccessor915.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:240)
      at com.sun.proxy.$Proxy104.merge(Unknown Source)
  
  Caused by: org.hibernate.exception.GenericJDBCException: could not load an entity: [com.mycomp.casa.persistence.model.CustomerAccountOpening#554]
      at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)
      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
      at org.hibernate.loader.Loader.loadEntity(Loader.java:2041)
      at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:86)
      at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:76)
      at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3293)
      at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:496)
      at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:477)
      at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227)
      at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:285)
      at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:152)
      at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1090)
      at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1038)
      at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:630)
      at org.hibernate.type.EntityType.resolve(EntityType.java:438)
      at org.hibernate.type.EntityType.replace(EntityType.java:298)
      at org.hibernate.type.AbstractType.replace(AbstractType.java:176)
      at org.hibernate.type.TypeHelper.replace(TypeHelper.java:212)
      at org.hibernate.event.def.DefaultMergeEventListener.copyValues(DefaultMergeEventListener.java:600)
      at org.hibernate.event.def.DefaultMergeEventListener.mergeTransientEntity(DefaultMergeEventListener.java:337)
      at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:303)
      at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:258)
      at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:84)
      at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:867)
      at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:851)
      at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:855)
      at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:686)
      ... 143 more
  Caused by: java.sql.SQLException: Error
      at org.jboss.jca.adapters.jdbc.WrappedConnection.checkException(WrappedConnection.java:1972)
      at org.jboss.jca.adapters.jdbc.WrappedStatement.checkException(WrappedStatement.java:1446)
      at org.jboss.jca.adapters.jdbc.WrappedResultSet.checkException(WrappedResultSet.java:5986)
      at org.jboss.jca.adapters.jdbc.WrappedResultSet.next(WrappedResultSet.java:2693)
      at org.hibernate.loader.Loader.doQuery(Loader.java:825)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
      at org.hibernate.loader.Loader.loadEntity(Loader.java:2037)
      ... 167 more
  Caused by: java.lang.ArrayIndexOutOfBoundsException: 128
      at oracle.jdbc.driver.T4CTTIrxd.readBitVector(T4CTTIrxd.java:135)
      at oracle.jdbc.driver.T4C8TTIrxh.unmarshalV10(T4C8TTIrxh.java:123)
      at oracle.jdbc.driver.T4C8Oall.readRXH(T4C8Oall.java:678)
      at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:436)
      at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:257)
      at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:587)
      at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:225)
      at oracle.jdbc.driver.T4CPreparedStatement.fetch(T4CPreparedStatement.java:1066)
      at oracle.jdbc.driver.OracleStatement.fetchMoreRows(OracleStatement.java:3716)
      at oracle.jdbc.driver.InsensitiveScrollableResultSet.fetchMoreRows(InsensitiveScrollableResultSet.java:1015)
      at oracle.jdbc.driver.InsensitiveScrollableResultSet.absoluteInternal(InsensitiveScrollableResultSet.java:979)
      at oracle.jdbc.driver.InsensitiveScrollableResultSet.next(InsensitiveScrollableResultSet.java:579)
      at org.jboss.jca.adapters.jdbc.WrappedResultSet.next(WrappedResultSet.java:2689)
      ... 170 more
  </code></pre>