java - Postgresql / Hibernate - Large Objects may not be used in auto-commit mode -
recently migrated application oracle
postgresql
(9.2.20). used org.hibernate.type.materializedblobtype
storing document contents (bytes
property) in db:
<hibernate-mapping > <class name="x.y.z.entities.documentdataentity" table="ds_document_data"> <id name="id" column="id_" type="java.lang.string"> <generator class="uuid2"/> </id> <property name="bytes" column="bytes_" type="org.hibernate.type.materializedblobtype"/> </class> </hibernate-mapping>
bytes
property in documentdataentity
class:
private byte[] bytes;
it works fine in oracle
in postgresql
, loading documentdataentity
throws exception:
18:54:57 error [ds/root] i.a.w.c.d.e.applicationexceptionhandler -| error occured in calling rest method! org.postgresql.util.psqlexception: large objects may not used in auto-commit mode. @ org.postgresql.largeobject.largeobjectmanager.open(largeobjectmanager.java:265) @ org.postgresql.largeobject.largeobjectmanager.open(largeobjectmanager.java:251) @ org.postgresql.jdbc.abstractblobclob.getlo(abstractblobclob.java:283) @ org.postgresql.jdbc.abstractblobclob.getbinarystream(abstractblobclob.java:127) @ org.hibernate.type.descriptor.java.primitivebytearraytypedescriptor.wrap(primitivebytearraytypedescriptor.java:115) ... 163 common frames omitted wrapped by: org.hibernate.hibernateexception: unable access lob stream @ org.hibernate.type.descriptor.java.primitivebytearraytypedescriptor.wrap(primitivebytearraytypedescriptor.java:118) @ org.hibernate.type.descriptor.java.primitivebytearraytypedescriptor.wrap(primitivebytearraytypedescriptor.java:26) @ org.hibernate.type.descriptor.sql.blobtypedescriptor$1.doextract(blobtypedescriptor.java:48) @ org.hibernate.type.descriptor.sql.basicextractor.extract(basicextractor.java:47) @ org.hibernate.type.abstractstandardbasictype.nullsafeget(abstractstandardbasictype.java:238) @ org.hibernate.type.abstractstandardbasictype.nullsafeget(abstractstandardbasictype.java:234) @ org.hibernate.type.abstractstandardbasictype.nullsafeget(abstractstandardbasictype.java:224) @ org.hibernate.type.abstractstandardbasictype.hydrate(abstractstandardbasictype.java:300) @ org.hibernate.persister.entity.abstractentitypersister.hydrate(abstractentitypersister.java:2790) @ org.hibernate.loader.plan.exec.process.internal.entityreferenceinitializerimpl.loadfromresultset(entityreferenceinitializerimpl.java:306) @ org.hibernate.loader.plan.exec.process.internal.entityreferenceinitializerimpl.hydrateentitystate(entityreferenceinitializerimpl.java:233) @ org.hibernate.loader.plan.exec.process.internal.abstractrowreader.readrow(abstractrowreader.java:103) @ org.hibernate.loader.plan.exec.internal.entityloadquerydetails$entityloaderrowreader.readrow(entityloadquerydetails.java:239) @ org.hibernate.loader.plan.exec.process.internal.resultsetprocessorimpl.extractresults(resultsetprocessorimpl.java:122) @ org.hibernate.loader.plan.exec.internal.abstractloadplanbasedloader.executeload(abstractloadplanbasedloader.java:122) @ org.hibernate.loader.plan.exec.internal.abstractloadplanbasedloader.executeload(abstractloadplanbasedloader.java:86) @ org.hibernate.loader.entity.plan.abstractloadplanbasedentityloader.load(abstractloadplanbasedentityloader.java:167) @ org.hibernate.persister.entity.abstractentitypersister.load(abstractentitypersister.java:4019) @ org.hibernate.event.internal.defaultloadeventlistener.loadfromdatasource(defaultloadeventlistener.java:508) @ org.hibernate.event.internal.defaultloadeventlistener.doload(defaultloadeventlistener.java:478) @ org.hibernate.event.internal.defaultloadeventlistener.load(defaultloadeventlistener.java:219) @ org.hibernate.event.internal.defaultloadeventlistener.doonload(defaultloadeventlistener.java:116) @ org.hibernate.event.internal.defaultloadeventlistener.onload(defaultloadeventlistener.java:89) @ org.hibernate.internal.sessionimpl.fireload(sessionimpl.java:1129) @ org.hibernate.internal.sessionimpl.immediateload(sessionimpl.java:997) @ org.hibernate.proxy.abstractlazyinitializer.initialize(abstractlazyinitializer.java:157) @ org.hibernate.proxy.abstractlazyinitializer.getimplementation(abstractlazyinitializer.java:266) @ org.hibernate.proxy.pojo.javassist.javassistlazyinitializer.invoke(javassistlazyinitializer.java:73)
note:
- i'm using
spring
(4.3.8.release) ,hibernate
(5.0.12.final). - i used
@transactional
annotaion indocumentdatamanager
bean'sload
method. - saving/loading works fine in
oracle
.
Comments
Post a Comment