openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andiqo <nocquid...@gmail.com>
Subject postgres : storing binary data using OID
Date Sun, 15 Mar 2009 20:53:44 GMT

Dear all, 

I am trying to persist large binary object using PostgreSQL database.
With this mapping, no problem but performance are not optimum for large
blobs:
// Object:
@Basic(fetch = FetchType.LAZY)
@Column(name = "DATA")
private byte[] data;
// Database:
CREATE TABLE SPLITBLOBPART (ID BIGSERIAL NOT NULL, DATA BYTEA, ..., PRIMARY
KEY (ID));
So I would like to use OIDs:
http://jdbc.postgresql.org/documentation/83/binary-data.html
I tried the following
// Object:
@Lob
@Basic(fetch = FetchType.LAZY)
@Column(name = "DATA", columnDefinition = "OID")
private byte[] data;
// Database:
CREATE TABLE SPLITBLOBPART (ID BIGSERIAL NOT NULL, DATA OID, ..., PRIMARY
KEY (ID)) WITH (OIDS=TRUE);
But I still get:
org.apache.openjpa.lib.jdbc.ReportingSQLException: ERREUR: la colonne « data
» est de type oid mais l'expression est de type bytea {prepstmnt 435456241
INSERT INTO SPLITBLOBPART (DATA, DATASIZE, ORDR, VERSION, PARENT_ID) VALUES
(?, ?, ?, ?, ?) [params=(byte[]) [B@773c550f, (int) 8000000, (int) 5, (int)
1, (long) 1]} [code=0, state=42804]
	at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:193)
	at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$700(LoggingConnectionDecorator.java:58)
	at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeUpdate(LoggingConnectionDecorator.java:983)
	at
org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:269)
	at
org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:269)
	at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeUpdate(JDBCStoreManager.java:1533)
	at
org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.executeUpdate(PreparedStatementManagerImpl.java:220)
	at
org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushAndUpdate(PreparedStatementManagerImpl.java:113)
What is the best way to achieve persistence using OIDs with PostgreSQL and
OpenJPA?!
Best regards,
andiqo
-- 
View this message in context: http://n2.nabble.com/postgres-%3A-storing-binary-data-using-OID-tp2482851p2482851.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Mime
View raw message