BLOB support [Was: "small" CLOB support]

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Sun Mar 02 2003 - 19:04:17 EST

  • Next message: Andrus Adamchik: "PostgreSQL Failures"

    Just checked in the same thing for BLOBs. A big step towards elusive
    "feature completness" :-).

    One issue though... BLOBs are mapped to byte[] wich is the only
    "persistence-primitive" type we have so far that is not immutable. So
    there is no clean object state tracking anymore. For instance:

    1. "commitChanges" will work as expected

    byte[] picture = ... // load from file
    myObj.setPicture(picture);
    dataContext.commitChanges();

    2. "commitChanges" will not save updated BLOB

    byte[] picture = myObj.getPicture();
    picture[3] = 5;
    dataContext.commitChanges();

    I guess we need an immutable byte[] wrapper (like NSData in EOF). Any
    other ideas? If there is none, I will create such wrapper and make it a
    default for all BINARY/BLOB columns reengineering.

    Andrus

    Andrus Adamchik wrote:
    > There has been lots of activity in Cayenne today :-) Here some more info
    > to digest...
    >
    > Just added support for "small" CLOBs. "Small" means anything the JVM can
    > handle in memory without using streams. Streaming access to LOBs will be
    > done later.
    >
    > Basically right now a String ObjAttribute can be mapped to a CLOB
    > DbAttribute, and it will "simply work". I successfully tested it with
    > Sybase and Oracle.
    >
    > To test if this works with other databases (Postgres?) that support
    > large objects in one way or another (so that it makes sense to have
    > DbAttributes of type CLOB at all),
    > org.objectstyle.cayenne.unittest.XyzDelegate must be implemented as a
    > subclass of DatabaseSetupDelegate, with method "supportsLobs" returning
    > true. (This is all located in the tests subproject of course).
    >
    > If you try it and it DOESN'T work, first place to look is
    > org.objectstyle.cayenne.access.types.CharType which has some
    > configuration options that control CLOB reading.
    >
    > I will be working on the similar BLOB support soon.
    >
    > Andrus



    This archive was generated by hypermail 2.0.0 : Sun Mar 02 2003 - 19:05:47 EST