Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Incorrect PostgreSQL's BLOB support in EclipseLink JPA(Incorrect PostgreSQL's BLOB support in EclipseLink JPA)
icon4.gif  Incorrect PostgreSQL's BLOB support in EclipseLink JPA [message #654596] Wed, 16 February 2011 12:58 Go to next message
Michal Piotrowski is currently offline Michal Piotrowski
Messages: 6
Registered: February 2011
Junior Member
I would like to start a discussion about incorrect support for PostgreSQL's BLOBs in EclipsLink. There are 2 binary types in PotgreSQL: bytea and Blob. bytea is correctly supported in EclipseLink JPA, but Blob is not correctly implemented.

Blobs in PostgreSQL are linked into table columns as blob's OID number, so column type is OID. PostgreSQL driver returns for this column:
TYPE_NAME="oid"
DATA_TYPE=java.sql.Types.BIGINT

But it is possible to obtain Blob using ResultSet.getBlob() method.

EclipseLink thinks that blob column should be a java.lang.Long and can't read the blob. The result is that correctly annotated by @Lob PostgreSQL's blob columns can't be read.

I think that EclipseLink should read oid columns as Blob if they are annotated as @Lob. Is it possible, that this will be corrected in future versions of EclipseLink?

I would like to add, that when I tested Hibernate JPA some time ago, Hibernate expected serializable fields annotated with @Lob to be oids in PostgreSQL, and serializable fields without @Lob annotation to be bytea (java.sql.Types.BINARY). I think that this approach to PostgreSQL binary types should be treated as the correct one.

Michal Piotrowski
Re: Incorrect PostgreSQL's BLOB support in EclipseLink JPA [message #654914 is a reply to message #654596] Thu, 17 February 2011 15:28 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Please log a bug for this. Is it just that reading does not work, or is the DDL created incorrectly?

You should be able to fix the issue by subclassing your PostgreSQLPlatform and overriding the getObjectFromResultSet() method. If you get this working please contribute it to the bug.



James : Wiki : Book : Blog : Twitter
Re: Incorrect PostgreSQL's BLOB support in EclipseLink JPA [message #654920 is a reply to message #654914] Thu, 17 February 2011 15:47 Go to previous message
Michal Piotrowski is currently offline Michal Piotrowski
Messages: 6
Registered: February 2011
Junior Member
The main problem is that reading does not work. I will try to subclass PostgreSQLPlatform before submitting bug.
The DDL also does not differentiate PostgreSQL binary types correctly (bytea, BLOB). It uses always bytea.
Previous Topic:JPA 1.2 Overhead
Next Topic:double record in history
Goto Forum:
  


Current Time: Fri Oct 24 07:56:25 GMT 2014

Powered by FUDForum. Page generated in 0.01555 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software