[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4617) Using blobs with hibernate causes error

Steve Ebersole (JIRA) noreply at atlassian.com
Mon May 10 16:28:24 EDT 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=37020#action_37020 ] 

Steve Ebersole commented on HHH-4617:
-------------------------------------

Yes LOB support in pgsql is, mmmmm, fun.

http://jdbc.postgresql.org/documentation/84/binary-data.html

{quote}
PostgreSQL™ provides two distinct ways to store binary data...
{quote}

The problem is that it really depends on the underlying column defintion.  For example, 
{quote}
To use the bytea data type you should simply use the getBytes(), setBytes(), getBinaryStream(), or setBinaryStream() methods.

To use the Large Object functionality you can use either the LargeObject class provided by the PostgreSQL™ JDBC driver, or by using the getBLOB() and setBLOB() methods. 
{quote}

Essentially there are 2 completely different ways to do BLOBs on pgsql and it does not do anything to make it transparent which you are using.

Anyway, have you made sure that streaming of lobs is disabled (hibernate.jdbc.use_streams_for_binary)?  For pgsql with an OID column it for sure sounds like this should be false (aka don't use get/setBinaryStream)

> Using blobs with hibernate causes error
> ---------------------------------------
>
>                 Key: HHH-4617
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4617
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.5.0-Beta-2
>         Environment: Hibernate 3.5-b2, Glassfish v3 promoted build 74, PostgreSQL 8.3.7
>            Reporter: Radosław Smogura
>            Assignee: Gail Badner
>            Priority: Critical
>             Fix For: 3.5.2, 3.6
>
>
> I have entity with byte[] property annotated as @Lob and lazy fetch type, when table is createad the created column is of type oid, but when the column is read in application, the Hibernate reads the OID value instead of bytes under given oid. It's behavior like to read / write bytea.
> If i remember well, auto-creating table with Hibernate creates oid column.
> The proper behavior for dealing in PostgreSQL (and this behavior is in Hibernate 3.4) is to use oids.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the hibernate-issues mailing list