My concern is that it seems too low-level, accessing DataNode directly (hence you have to manage connection state and all that). But there is another more fundamental problem of a Blob becoming invalid when the connection that generated it is closed.

So I wonder if instead of mapping a column directly as a Blob, we should implement our own mapping primitive (BlobHolder?), that can re- read the Blob as many times as requested. The other piece is a callback interface that is provided with the regular Blob instance guaranteed to be in the valid state (i.e. inside a Cayenne transaction). A callback can read the stream, and do whatever with it (like pushing data to HttpResponse):

interface (or class) BlobHolder {
   void readBlob(BlobCallback callback);
}

interface BlobCallback {
// this is called within transaction span and the Blob is guaranteed to be valid
   void blobRead(Blob);
}

We can use a BlobFault similar to what you wrote as a way to initialize BlobHolder with an object qualifier (so that it knows how to fetch itself).

What do you think?

Andrus




On Nov 20, 2006, at 6:21 PM, Tore Halset (JIRA) wrote:
     [ http://issues.apache.org/cayenne/browse/CAY-316?page=all ]

Tore Halset updated CAY-316:
----------------------------

    Attachment: BlobFaultType.java

stream support for blob/clob
----------------------------

         Key: CAY-316
         URL: http://issues.apache.org/cayenne/browse/CAY-316
     Project: Cayenne
        Type: New Feature

  Components: Cayenne Core Library
    Versions: 1.2 [STABLE]
    Reporter: Tore Halset
    Assignee: Andrus Adamchik
    Priority: Minor
     Fix For: UNDEFINED FUTURE
 Attachments: BlobFault.java, BlobFaultType.java

It would be nice if cayenne would support for streaming blob/clob. It should at least be possible to prevent caching of blobs.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/cayenne/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira



Reply via email to