Sorry but something happened with my gmail and I can't see your last email.
2008/9/3 Ognjen Blagojevic <[EMAIL PROTECTED]>
> 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 <[EMAIL PROTECTED]>
>>
>> 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 <[EMAIL PROTECTED]>
>>>>
>>>> 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:
>>>>>
>>>>> <openjpa-1.3.0-SNAPSHOT-runknown nonfatal general error>
>>>>> 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;
>>> }
>>>
>>> }
>>>
>>>
>>>
>