Uploaded image for project: 'Isis'
  1. Isis
  2. ISIS-812

Isis 1.5 blob mapping broken for PostgreSQL (when set to null)

    Details

      Description

      As reported on mailing list: http://markmail.org/thread/zoiu2v4sklo7mevq

      ~~~
      Looking into this, I've learnt that PostgreSQL does not support BLOB datatype, but instead supports "bytea" (byte array) and "oid". The first is in-row storage, where the data is always returned in the result set, the second is a pointer to off-row storage; PostgreSQL provides its own API for handling oid types).

      For the Isis Blob class (org.apache.isis.applib.value.Blob) we provide our own IsisBlobMapping; this is automatically registered through metadata held in the JDO applib jar. It is the job of this mapping class to read/set values on the underlying ResultSet / PreparedStatement. DataNucleus provides some additional wrapping infrastructure.

      The warning mentioned in the mailing list post indicates that DN is treating the BLOB datatype as a "bytea". This almost works fine; our IsisBlobMapping can persist non-null values ok, but attempting to set a null value breaks PostgreSQL; it treats the null as a null pointer of type "oid" (offline storage), rather than a null of type "bytea".

      After some experimentation, I've found a different way to set null that works for PostgreSQL and also works fine for HSQLDB, and MS SQL Server.

      This ticket is to apply that change.

        Attachments

          Activity

            People

            • Assignee:
              danhaywood Dan Haywood
              Reporter:
              danhaywood Dan Haywood
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: