pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #6241: JDBC: blob doesnot work with bytea
2+ messages / 2 participants
[nested] [flat]
* BUG #6241: JDBC: blob doesnot work with bytea
@ 2011-10-06 08:26 Stefan Franke <stefan@franke.ms>
2011-10-19 12:02 ` Re: BUG #6241: JDBC: blob doesnot work with bytea Robert Haas <robertmhaas@gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Franke @ 2011-10-06 08:26 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged online:
Bug reference: 6241
Logged by: Stefan Franke
Email address: stefan@franke.ms
PostgreSQL version: 9.1
Operating system: any
Description: JDBC: blob doesnot work with bytea
Details:
To persist a blob you can also use bytea. Unfortunately the JDBC driver does
not support this.
Especially if you can't control the way how the column is accessed, e.g.
using JPA
@Lob
@Column(name = "DATA") // using bytea
private byte[] data;
it fails with distinct JPA implementations (e.g. Hibernate) since the JPA
layer tries to access it as blob.
My workaround is to patch the class org.postgresql.jdbc4.Jdbc4ResultSet:
public java.sql.Blob getBlob(int i) throws SQLException
{
checkResultSet(i);
if (wasNullFlag)
return null;
try {
return new Jdbc4Blob(connection, getLong(i));
} catch (PSQLException ex) {
// bytea use a dummy Blob
return new SerialBlob(getBytes(i));
}
}
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #6241: JDBC: blob doesnot work with bytea
2011-10-06 08:26 BUG #6241: JDBC: blob doesnot work with bytea Stefan Franke <stefan@franke.ms>
@ 2011-10-19 12:02 ` Robert Haas <robertmhaas@gmail.com>
0 siblings, 0 replies; 2+ messages in thread
From: Robert Haas @ 2011-10-19 12:02 UTC (permalink / raw)
To: Stefan Franke <stefan@franke.ms>; +Cc: pgsql-bugs
On Thu, Oct 6, 2011 at 4:26 AM, Stefan Franke <stefan@franke.ms> wrote:
>
> The following bug has been logged online:
>
> Bug reference: 6241
> Logged by: Stefan Franke
> Email address: stefan@franke.ms
> PostgreSQL version: 9.1
> Operating system: any
> Description: JDBC: blob doesnot work with bytea
> Details:
>
> To persist a blob you can also use bytea. Unfortunately the JDBC driver does
> not support this.
I think you'll need to raise this issue on the pgsql-jdbc mailing
list, as this list is only for bugs in the core distribution.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2011-10-19 12:02 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-10-06 08:26 BUG #6241: JDBC: blob doesnot work with bytea Stefan Franke <stefan@franke.ms>
2011-10-19 12:02 ` Robert Haas <robertmhaas@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox