From dev-return-9094-apmail-openjpa-dev-archive=openjpa.apache.org@openjpa.apache.org Wed Sep 03 15:01:13 2008 Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 51723 invoked from network); 3 Sep 2008 15:01:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Sep 2008 15:01:13 -0000 Received: (qmail 33607 invoked by uid 500); 3 Sep 2008 15:01:11 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 33580 invoked by uid 500); 3 Sep 2008 15:01:11 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 33569 invoked by uid 99); 3 Sep 2008 15:01:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Sep 2008 08:01:11 -0700 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [147.91.1.122] (HELO mx.rcub.bg.ac.yu) (147.91.1.122) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Sep 2008 15:00:13 +0000 Received: from [147.91.4.66] (ognjen-pc.rcub.bg.ac.yu [147.91.4.66]) by mx.rcub.bg.ac.yu (Postfix) with ESMTP id 809C51919842 for ; Wed, 3 Sep 2008 17:00:33 +0200 (CEST) Message-ID: <48BEA538.4020607@etf.bg.ac.yu> Date: Wed, 03 Sep 2008 16:54:48 +0200 From: Ognjen Blagojevic User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: dev@openjpa.apache.org Subject: Re: Problem with streaming support on PostgreSQL References: <48BE9312.6060906@etf.bg.ac.yu> <41fba98d0809030655u2ff80711m26290bb4e796961e@mail.gmail.com> In-Reply-To: <41fba98d0809030655u2ff80711m26290bb4e796961e@mail.gmail.com> Content-Type: multipart/mixed; boundary="------------080401000706010904030507" X-RCUB-MailScanner-Information: Please contact the ISP for more information X-RCUB-MailScanner: Found to be clean X-Virus-Checked: Checked by ClamAV on apache.org --------------080401000706010904030507 Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 8bit Here it is. -Ognjen Ignacio Andreu wrote: > Hi Ognjen, > Apache OpenJPA doesn't expect an integer is a problem with Postgres. This > problem happens when you try to stream binary data in a bytea column, for > this reason I used the specific table pg_largeobject and the > LargeObjectManager to manage the binary objects in the streaming LOB > support. Can you send you entity? (is no attached in the e-mail). > > Thanks, > > 2008/9/3 Ognjen Blagojevic > >> Hi devs, >> >> I have a problem using streams under PostgreSQL 8.1. Fairly simple JPQL >> query like this: >> >> select i from Image i >> >> Throws an exception: >> >> >> org.apache.openjpa.persistence.PersistenceException: Bad value for type int >> : \001\002\003\004 >> at >> org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4239) >> at >> org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4204) >> ... >> Caused by: org.postgresql.util.PSQLException: Pogrešna vrednost za tip int >> : \001\002\003\004 >> at >> org.postgresql.jdbc2.AbstractJdbc2ResultSet.toInt(AbstractJdbc2ResultSet.java:2699) >> at >> org.postgresql.jdbc2.AbstractJdbc2ResultSet.getInt(AbstractJdbc2ResultSet.java:2016) >> at >> org.apache.openjpa.lib.jdbc.DelegatingResultSet.getInt(DelegatingResultSet.java:134) >> at >> org.apache.openjpa.jdbc.sql.PostgresDictionary.getLOBStream(PostgresDictionary.java:338) >> ... >> >> >> You can find Image.java in the attachment. >> >> Before the exception there was a warning witch foreruns the exception: >> >> 16 magazinePu WARN [main] openjpa.MetaData - >> "magazine.model.Image.logo" declares a column "logo" whose JDBC type is not >> compatible with the expected type "integer". >> >> Column logo is defined as BYTEA in PostgreSQL database, which is I beleive, >> correct. It is suspicious why the expected type is integer? >> >> Configuration: >> - OpenJPA 1.2.0 / OpenJPA 1.3.0 SNAPSHOT >> - Enhancing at Build Time >> - PostgreSQL 8.1.11 >> >> Regards, >> Ognjen >> >> --------------080401000706010904030507 Content-Type: text/plain; name="Image.java" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="Image.java" package magazine.model; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import java.io.InputStream; import javax.persistence.Lob; import org.apache.openjpa.persistence.Persistent; @Entity public class Image implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="id") private int id; @Column(name="name") private String name; @Lob @Persistent @Column(name="logo") private InputStream logo; private static final long serialVersionUID = 1L; public int getId() { return this.id; } public void setId(int id) { this.id = id; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public InputStream getLogo() { return this.logo; } public void setLogo(InputStream logo) { this.logo = logo; } } --------------080401000706010904030507--