[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.rt.eclipselink] Re: read blob as byte array issue
|
Hello James,
In my TABLE splitblobpart:
(
id bigserial NOT NULL,
data oid,
datasize integer,
ordr integer,
"version" integer,
parent_id bigint NOT NULL,
CONSTRAINT splitblobpart_pkey PRIMARY KEY (id)
)
I have the following data:
"1";36354;8000000;0;1;1
With this url:
<property name="javax.persistence.jdbc.url"
value="jdbc:postgresql://localhost:5432/jenmo" />
the code:
Connection conn = JpaSpiActions4Test.getInstance().getConnection(em);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
Long oid = rs.getLong(1);
System.out.println(oid);
}
produce 36354 -> OK
With this url:
<property name="javax.persistence.jdbc.url"
value="jdbc:postgresql://localhost:5432/jenmo?compatible=7.1" />
the code:
Connection conn = JpaSpiActions4Test.getInstance().getConnection(em);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
byte[] bytes = rs.getBytes(1);
System.out.println(bytes.length);
}
produce 8000000 -> OK
Then accessing my SplitBlobPartObject:
[EL Fine]: 2009-04-08
21:36:57.199--ServerSession(1884473012)--Connection(112258534)--Thread(Thread[main,5,main])--SELECT
ID, ORDR, DATASIZE, DATA, VERSION, PARENT_ID FROM SPLITBLOBPART WHERE
(PARENT_ID = ?) ORDER BY ORDR ASC
bind => [1]
[EL Warning]: 2009-04-08
21:36:57.204--UnitOfWork(203141979)--Thread(Thread[main,5,main])--Exception
[EclipseLink-3002] (Eclipse Persistence Services - 2.0.0.r3652-M1):
org.eclipse.persistence.exceptions.ConversionException
Exception Description: The object [36 354], of class [class
java.lang.Long], from mapping
[org.eclipse.persistence.mappings.DirectToFieldMapping[data-->SPLITBLOBPART.DATA]]
with descriptor [RelationalDescriptor(org.jenmo.core.domain.SplitBlobPart
--> [DatabaseTable(SPLITBLOBPART)])], could not be converted to [class [B].
Same issue with lazy loading disabled.
Thanks a lot for your help!
andiqo