SQLException "Stream already closed" for Oracle LONG RAW in Hibernate

Solution Verified - Updated -

Issue

  • When loading an entity with an Oracle LONG RAW type field, entity manager find(...) fails:
java.sql.SQLException Stream already closed.
    at oracle.jdbc.driver.LongRawAccessor.getBytes(LongRawAccessor.java:162)
    at oracle.jdbc.driver.OracleResultSetImpl.getBytes(OracleResultSetImpl.java:722)
    at oracle.jdbc.driver.OracleResultSet.getBytes(OracleResultSet.java:402)
    at org.jboss.jca.adapters.jdbc.WrappedResultSet.getBytes(WrappedResultSet.java:699)
    at org.hibernate.type.descriptor.sql.VarbinaryTypeDescriptor$2.doExtract(VarbinaryTypeDescriptor.java:66)
    ...
    at org.jboss.as.jpa.container.AbstractEntityManager.find(AbstractEntityManager.java:193)
  • The entity for which the find() is executed is loaded, along with an associated entity (via JOIN for a ManyToOne association)
  • The associated entity has a LONG RAW field

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 6
  • Hibernate 4
  • Oracle

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content