Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Blob and PostgreSQL

Is the code attached to this bug any help?

https://bugs.eclipse.org/bugs/show_bug.cgi?id=337467

If so, you can subclass PostgreSQLPlatform to make use of that code and enable it by specifying the name of your subclass in the persistence unit property "eclipselink.target-database".

-Tom

On 24/06/2013 4:30 AM, Andreas Joseph Krogh wrote:
Hi.
I see in PostgreSQLPlatform this code:

//**/
  /* Return the JDBC type for the Java type. For some reason PostgreSQL does/
  /* not seem to like the JDBC Blob type (PostgreSQL 8.2)./
  /*//
@Override
*public int*getJDBCType(*Class*javaType) {
     *if*(javaType ==*ClassConstants*./*BLOB*/) {
         *return**Types*./*LONGVARBINARY*/;
     }
     *return super*.getJDBCType(javaType);
}

This indicates that EclipseLink doesn't use PG's OID-type for blobs (and testing
shows EL generates bytea-columns for JPA-fields of type java.sql.Blob). I need
to store quite large binaries in my DB so storing them as byte-arrays (PG's
bytea) doesn't work for me, I need to work with streams. I need be able to call
myBinaryProperty.getBinaryStream() on a JPA-entity holding this blob.
Is there a way to teach EclipseLink to treat Blobs as PG's OID-type?
Thanks.
--
Andreas Joseph Krogh <andreak@xxxxxxxxxxxx>      mob: +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users



Back to the top