Re: RES: Problems retrieving data from bytea field - Mailing list pgsql-jdbc
From | Sherman Wood |
---|---|
Subject | Re: RES: Problems retrieving data from bytea field |
Date | |
Msg-id | 008001c32337$f45a7c10$0a0110ac@SHERMANLNCVEH0 Whole thread Raw |
In response to | Re: RES: Problems retrieving data from bytea field ("Sherman Wood" <sgwood@ix.netcom.com>) |
List | pgsql-jdbc |
I just ran into this as well.
Change your Hibernate mapping of the column to 'binary', instead of 'blob'.
The get/set methods for the column, and the underlying instance variable, will deal with byte[], instead of java.sql.Blob.
The issue you are running into is that Postgres deals with Blobs as lobs, and Hibernate does not understand that properly.
Hope this helps,
Sherman
----- Original Message -----From: Sherman WoodSent: Tuesday, May 20, 2003 5:13 AMSubject: Re: [JDBC] RES: Problems retrieving data from bytea fieldI am still having problems with this. My environment is JDK 1.4.1_02, Win2K, Eclipse 2.1, Postgres 7.3.2.When I select a row with a bytea in it and try to get the blob, I am getting the following behavior:Under pg72jdbc2.jar:Bad Integer <?xml version="1.0"?>\012<!DOCTYPE hibernate-mapping PUBLIC ....
at org.postgresql.jdbc2.ResultSet.toInt(ResultSet.java:1481)
at org.postgresql.jdbc2.ResultSet.getInt(ResultSet.java:247)
at org.postgresql.jdbc2.ResultSet.getBlob(ResultSet.java:934)
at org.postgresql.jdbc2.ResultSet.getBlob(ResultSet.java:929)
at net.sf.hibernate.type.BlobType.get(BlobType.java:26)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:59)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:51)
at net.sf.hibernate.type.AbstractType.hydrate(AbstractType.java:65)
at net.sf.hibernate.loader.Loader.hydrate(Loader.java:408)
at net.sf.hibernate.loader.Loader.loadFromResultSet(Loader.java:358)
at net.sf.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:332)
at net.sf.hibernate.loader.Loader.getRow(Loader.java:273)
at net.sf.hibernate.loader.Loader.doFind(Loader.java:150)
at net.sf.hibernate.loader.Loader.find(Loader.java:602)
at net.sf.hibernate.hql.QueryTranslator.find(QueryTranslator.java:860)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1338)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1317)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1309)
at com.galenworks.procedurelink.hibernate.test.Populate.test6(Populate.java:374)
at com.galenworks.procedurelink.hibernate.test.Populate.main(Populate.java:411)Under pg73jdbc2.jar:Bad Integer <?xml version="1.0"?>\012<!DOCTYPE hibernate-mapping PUBLIC \012...
at org.postgresql.jdbc1.AbstractJdbc1ResultSet.toInt(AbstractJdbc1ResultSet.java:700)
at org.postgresql.jdbc1.AbstractJdbc1ResultSet.getInt(AbstractJdbc1ResultSet.java:144)
at org.postgresql.jdbc3.Jdbc3ResultSet.getBlob(Jdbc3ResultSet.java:41)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getBlob(AbstractJdbc2ResultSet.java:262)
at net.sf.hibernate.type.BlobType.get(BlobType.java:26)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:59)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:51)
at net.sf.hibernate.type.AbstractType.hydrate(AbstractType.java:65)
at net.sf.hibernate.loader.Loader.hydrate(Loader.java:408)
at net.sf.hibernate.loader.Loader.loadFromResultSet(Loader.java:358)
at net.sf.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:332)
at net.sf.hibernate.loader.Loader.getRow(Loader.java:273)
at net.sf.hibernate.loader.Loader.doFind(Loader.java:150)
at net.sf.hibernate.loader.Loader.find(Loader.java:602)
at net.sf.hibernate.hql.QueryTranslator.find(QueryTranslator.java:860)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1338)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1317)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1309)
at com.galenworks.procedurelink.hibernate.test.Populate.test6(Populate.java:367)
at com.galenworks.procedurelink.hibernate.test.Populate.main(Populate.java:404)Any help would be appreciated.Thanks,Sherman
pgsql-jdbc by date: