Dan Haywood created ISIS-812:
--------------------------------
Summary: Isis 1.5 blob mapping broken for PostgreSQL (when set to
null)
Key: ISIS-812
URL: https://issues.apache.org/jira/browse/ISIS-812
Project: Isis
Issue Type: Bug
Components: Archetype: ToDoApp WRJ, Objectstore: JDO
Affects Versions: objectstore-jdo-1.5.0, archetype-quickstart-wrj-1.5.0
Reporter: Dan Haywood
Assignee: Dan Haywood
Priority: Minor
Fix For: archetype-quickstart_wrj-1.6.0, objectstore-jdo-1.6.0
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.
--
This message was sent by Atlassian JIRA
(v6.2#6252)