Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HibernateException: Unable to access lob stream

I have a problem. I have a Spring Boot project using Hibernate and I can not query an OID in the database.

@Lob
@Column(name = "documento_oid")
private byte[] documentoOid;

Query:

if (tupled) {
        return em.createQuery(getTupleQuery())
                .setMaxResults(1)
                .getResultList().stream().findFirst().map(t -> (T) getWrappedInstance(t)).orElse(null);
    } else {
        return em.createQuery(getQueryT())
                .getSingleResult();
    }

image

Error: javax.persistence.PersistenceException: org.hibernate.HibernateException: Unable to access lob stream

Help me!

like image 431
Leonardo Giuliani Avatar asked Oct 15 '25 03:10

Leonardo Giuliani


1 Answers

Adding following application properties make it work for us:

spring.datasource.autoCommit=false
like image 103
Neo Avatar answered Oct 17 '25 17:10

Neo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!