Re: Postgresql Blob/LargeObject support i..[ANOTHER PROBLEM]

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Oct 03 2005 - 16:46:06 EDT

  • Next message: Oscar Picasso: "Re: Postgresql Blob/LargeObject support i..[ANOTHER PROBLEM]"

    > Is there another place where I could tell Cayenne to use 'oid'
    > for Blobs, in anycase?

    Cayenne runtime doesn't care about oid vs. bytea, as it works in
    terms of JDBC standard types. The only place where this matters is
    schema generation from the Modeler where an "abstract" JDBC type is
    translated to a DB-specific one. More control over this will be
    implemented in the future, for now you can edit types.xml file
    located in cayenne.jar under dba/postgres. But again - this will only
    affect the Modeler and will not resolve nulls problem.

    > However, if, on inserts, the Blob is null, Cayenne doesn't use the
    > ExtendedType
    > and I get again an Exception:

    It does, however the type is reset to VARBINARY (see line 332 in
    PostgresAdapter.java from CVS). So we don't need to introduce any
    special support for oid, but we need to drop special support for
    "bytea as blob"... let it be mapped as byte[]. Any such change will
    likely include remapping types.xml.

    For now you can do two things:

    * switch to Cayenne 1.2M4 that doesn't have this unfortunate
    'workaround' in the adapter.
    * Open a bug report in JIRA, so that we don't forget about it.

    > It seems Cayenne chose the ExtendedType based on the actual class
    > of the
    > DataObject property.
    >
    > Wouldn't it be better to use the declared class instead?

    Maybe. This is a bigger refactoring issue though and there are a few
    caveats.

    Andrus

    On Oct 3, 2005, at 4:16 PM, Oscar Picasso wrote:
    > Hi again,
    >
    > I thought that my blobs problems were solved.
    >
    > However, if, on inserts, the Blob is null, Cayenne doesn't use the
    > ExtendedType
    > and I get again an Exception:
    >
    > ...
    > Caused by: org.postgresql.util.PSQLException: ERROR: column
    > "content" is of
    > type oid but expression is of type bytea
    > ...
    >
    > It seems Cayenne chose the ExtendedType based on the actual class
    > of the
    > DataObject property.
    >
    > Wouldn't it be better to use the declared class instead?
    >
    > Any other idea? Is there another place where I could tell Cayenne
    > to use 'oid'
    > for Blobs, in anycase?
    >
    > Oscar



    This archive was generated by hypermail 2.0.0 : Mon Oct 03 2005 - 16:46:08 EDT