Home > large objects > psqlexception error invalid large-object descriptor 0

Psqlexception Error Invalid Large-object Descriptor 0

Contents

Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it https://forum.hibernate.org/viewtopic.php?f=1&t=958767 only takes a minute: Sign up Large Objects may not be used in auto-commit mode up vote 12 down vote favorite 3 I have a Spring application which uses Hibernate on a PostgreSQL database. I'm trying to store files in a table of the database. It seems it stores the row with the file (I just use persist method on EntityManager), http://stackoverflow.com/questions/3164072/large-objects-may-not-be-used-in-auto-commit-mode but when the object is loaded from the database I get the following exception: org.postgresql.util.PSQLException: Large Objects may not be used in auto-commit mode. To load the data I'm using a MultipartFile transient atribute and in its setter I'm setting the information I want to persist (byte[], fileName, size). The entity I'm persisting looks like this one (I've ommitted the rest of getters/setters): @Entity @Table(name="myobjects") public class MyClass { @Id @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="sequence") @SequenceGenerator(name="sequence", sequenceName="myobjects_pk_seq", allocationSize=1) @Column(name="id") private Integer id; @Lob private String description; @Temporal(TemporalType.TIMESTAMP) private Date creationDate; @Transient private MultipartFile multipartFile; @Lob @Basic(fetch=FetchType.LAZY, optional=true) byte[] file; String fileName; String fileContentType; Integer fileSize; public void setMultipartFile(MultipartFile multipartFile) { this.multipartFile = multipartFile; try { this.file = this.multipartFile.getBytes(); this.fileName = this.multipartFile.getOriginalFilename(); this.fileContentType = this.multipartFile.getContentType(); this.fileSize = ((Long) this.multipartFile.getSize()).intValue(); } catch (IOException e) { logger.error(e.getStackTrace()); } } } I can see that when it is persisted I have the data in the row but when I call this method it fails: public List findByDescription(String text) { Query query = getEntityManager().createQuery("from MyClass WHERE UPPER(description) like :query ORDER BY creationDate DESC"); query.setParameter("query", "%" + text.toUpperCase()

BoardInsert Lucidchart Diagram ExportXMLWordPrintable Details Type: Bug Status: Closed Resolution: Fixed Affects Version/s: 6.1.1 CE GA2, 6.1.20 EE GA2 Fix Version/s: 6.1.30 EE GA3, 6.2.0 CE large objects M2 Component/s: Environments, Environments > Databases Labels: QA-F QA-R Environment: Jboss 5.1, Tomcat 6, Jboss 5.1, Nuxeo DM 5.5.0-HF6, OpenJDK 6. FreeBSD 8.3 RC2, Liferay 6.1.+ CE. PostgreSQL 9.1 large objects may Branch Version/s: 6.1.x Backported to Branch: Committed Fix Priority: 5 Description I'm Using these settings in portal-ext.properties. image.hook.impl=com.liferay.portal.image.DatabaseHook dl.store.impl=com.liferay.portlet.documentlibrary.store.DBStore changing the Logo from the portal and store the new one as blob inside the database provides these expation 17:26:30,712 ERROR [ImageProcessorImpl:269] java.io.IOException: org.postgresql.util.PSQLException: ERROR: invalid large-object descriptor: 1 java.io.IOException: org.postgresql.util.PSQLException: ERROR: invalid large-object descriptor: 1 at org.postgresql.largeobject.BlobInputStream.read(BlobInputStream.java:98) at java.io.InputStream.read(InputStream.java:170) at java.io.InputStream.read(InputStream.java:101) at com.liferay.portal.kernel.util.StreamUtil.transferByteArray(StreamUtil.java:206) at com.liferay.portal.kernel.util.StreamUtil.transfer(StreamUtil.java:162) at com.liferay.portal.kernel.util.StreamUtil.transfer(StreamUtil.java:129) at com.liferay.portal.util.FileImpl.getBytes(FileImpl.java:401) at com.liferay.portal.util.FileImpl.getBytes(FileImpl.java:387) at com.liferay.portal.util.FileImpl.getBytes(FileImpl.java:381) at com.liferay.portal.kernel.util.FileUtil.getBytes(FileUtil.java:153) at com.liferay.portlet.documentlibrary.util.ImageProcessorImpl._generateImages(ImageProcessorImpl.java:248) at com.liferay.portlet.documentlibrary.util.ImageProcessorImpl.generateImages(ImageProcessorImpl.java:85) at com.liferay.portlet.documentlibrary.util.ImageProcessorUtil.generateImages(ImageProcessorUtil.java:38) at com.liferay.portlet

 

Related content

org.postgresql.util.psqlexception error invalid large-object descriptor

Org postgresql util psqlexception Error Invalid Large-object Descriptor p here for a quick overview of relatedl the site Help Center Detailed answers to large objects may not be used in auto-commit mode postgres any questions you might have Meta Discuss the workings and org hibernate exception genericjdbcexception large objects may not be used in auto-commit mode policies of this site About Us Learn more about Stack Overflow the company Business Learn more sql error sqlstate p about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow

org.postgresql.util.psqlexception error invalid large-object descriptor 0

Org postgresql util psqlexception Error Invalid Large-object Descriptor table id toc tbody tr td div id toctitle Contents div ul li a href Large Objects May Not Be Used In Auto-commit Mode Postgres a li ul td tr tbody table p Red Hat Inc All rights reserved JBoss and Hibernate are registered trademarks and servicemarks of Red Hat Inc p p pgsql-announce pgsql-bugs pgsql-docs pgsql-general pgsql-interfaces pgsql-jobs pgsql-novice pgsql-performance pgsql-php relatedl pgsql-sql pgsql-students Developer lists Regional lists Associations User groups Project lists Inactive lists IRC Local User Groups Featured Users International Sites Propaganda Resources Weekly News Re Invalid large object