From dev-return-9110-apmail-openjpa-dev-archive=openjpa.apache.org@openjpa.apache.org Wed Sep 03 23:09:32 2008 Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 80327 invoked from network); 3 Sep 2008 23:09:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Sep 2008 23:09:32 -0000 Received: (qmail 48865 invoked by uid 500); 3 Sep 2008 23:09:30 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 48844 invoked by uid 500); 3 Sep 2008 23:09:30 -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 Delivered-To: moderator for dev@openjpa.apache.org Received: (qmail 71913 invoked by uid 99); 3 Sep 2008 15:22:47 -0000 X-ASF-Spam-Status: No, hits=-1.0 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Message-ID: <48BEAA4E.7060205@rcub.bg.ac.yu> Date: Wed, 03 Sep 2008 17:16:30 +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> <48BEA538.4020607@etf.bg.ac.yu> <41fba98d0809030804m7505ea90o5f7071d0092a62db@mail.gmail.com> In-Reply-To: <41fba98d0809030804m7505ea90o5f7071d0092a62db@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 8bit 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 Tried that already. I get the same exception. -Ognjen Ignacio Andreu wrote: > Can you try to remove the @LOB annotation? Mark it as @Persistent should be > enough. > Thanks, > > 2008/9/3 Ognjen Blagojevic > >> 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 >>>> >>>> >>>> >> 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; >> } >> >> } >> >>