Skip to main content

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

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

Back to the top