I also like the approach of using an annotation on an InputStream
object, but that only deals with streaming reads and ignores streaming
writes (which are just as important for large datasets). I think that
instead of using an InputStream we would have to use a new data type
that could provide both an InputStream and an OutputStream.
I suppose another possibility would be using a
java.nio.channels.ByteChannel (which is the base class of both
ReadableByteChannel and WritableByteChannel) and providing the correct
concrete implementation depending on whether it's accessed by the
getter or setter. A channel can of course be converted to an
InputStream/OutputStream and vice-versa in the client as needed. As
an ancillary benefit, if Jets3t were ever to support NIO then having
channel support end-to-end would enable more efficient IO with in-
kernel direct buffers.
In the meantime, after I verify it works I will post what I have as an
example and we can discuss the API from there.
Craig
> <
sanne.grinov...@gmail.com>wrote:
>
> > Hi,
> > you should mention this issue to the JPA2 expert group, as it would be
> > useful for something like this to be included in the standard.
> > I doubt that it would make sense to have a @Lob on such a getter, as it
> > would be a self-kill to try using this get method, but I agree there
> > should be some easy and standard way to retrieve a stream from a lob in
> > Database wihout having to be aware of the SQL specifics of
> > the current database.
> > How would your API lok like?
> > I expect something like
> > Stream s = em.getStreamingLob( Serializable IdOfContainingEntity, String
> > fieldName);
> > or something like OpenJPA; for reference I found this JIRA:
> >
http://issues.apache.org/jira/browse/OPENJPA-130
> > I wonder why this cool solution was not included in JPA2.
>
> > 2009/1/3 Craig B <
craigwbl...@gmail.com>