openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Goldner <>
Subject Problem reading persisted InputStream
Date Mon, 11 Aug 2008 04:18:03 GMT
I am trying to use the new lob streaming functionality in 1.1.0.  My
database is Derby.  Is Derby even supported for lob streaming?  My initial
test is to simply write a file to Derby and then read it back out to disk.

I can save the stream to the db without any errors.  However, when I attempt
to retrieve the instance I always get an error when I try to read from the

The basic code looks like this:


InstanceEntity instance = new InstanceEntity();
InputStream fis = new BufferedInputStream(new FileInputStream(file));


InstanceEntity instance = entityManager.find(InstanceEntity.class, id);
InputStream fis = (InputStream) instance.getInstanceData();
int b =;

I've tried a variety of InputStreams (FileInputStream, BufferedInputStream,
etc.) and they all seem to fail when I attempt to read() from them.  Writing
the object to the db using a BufferedInputStream results in a
" Stream closed" on the read().

In the openjpa tests, I see some code for an InputStreamWrapper
s/  There seems to be some handling surrounding the
flushing of a stream.  Is this related to (or a fix for) the issue I'm



View raw message