You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by xj...@nurfuerspam.de on 2014/06/16 17:35:06 UTC

Isis 1.5 and blobs with jdo/postgresql

Hi,

I tried to use isis 1.5. instead of 1.4 in our app and ran into some exceptions because of blobs (we use postgresql 9). Then I tried it with a fresh ToDoApp and the same thing happened. I removed the comments from the lines for PostgreSQL Server in persistor.properties, commented out the lines for HSQLDB and created an empty db named isis. Running the ToDoApp-PROTOTYPE-with-fixtures.launch first logs two warnings:

[Schema main WARN ]  Attempt to find JDBC driver 'typeInfo' for jdbc-type=BLOB but sql-type=BLOB is not found. Using default sql-type for this jdbc-type.
[Schema main WARN ]  Attempt to find JDBC driver 'typeInfo' for jdbc-type=CLOB but sql-type=CLOB is not found. Using default sql-type for this jdbc-type

and then the exception

[FixturesInstallerDelegate main ERROR]  installing fixture fixture.todo.scenarios.RecreateToDoItemsForSven failed; aborting 
javax.jdo.JDODataStoreException: Insert of object "dom.todo.ToDoItem@367a1d62" using statement "INSERT INTO "ToDoItem" 
("ownedBy","notes","cost","complete","subcategory","description","doc_name","doc_mimetype","doc_chars","category","attachment_name","attachment_mimetype","attachment_bytes","dueBy","version") VALUES 
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" failed : FEHLER: Spalte »attachment_bytes« hat Typ bytea, aber der Ausdruck hat Typ oid
  Hinweis: Sie müssen den Ausdruck umschreiben oder eine Typumwandlung vornehmen.
  Position: 263
        at org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:451)
        at org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:732)
        at org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:752)
        at org.apache.isis.objectstore.jdo.datanucleus.persistence.commands.DataNucleusCreateObjectCommand.execute(DataNucleusCreateObjectCommand.java:54)
.......
Caused by: org.postgresql.util.PSQLException: FEHLER: Spalte »attachment_bytes« hat Typ bytea, aber der Ausdruck hat Typ oid
  Hinweis: Sie müssen den Ausdruck umschreiben oder eine Typumwandlung vornehmen.
  Position: 263
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
.....

The error message translates to 
"ERROR: Column "attachment_bytes" is of type bytea but expression is of type oid.

I read something about a fixed blob/clob mapping (ISIS-714) on the blog. Is this exception a datanucleus issue?
Right now I have no idea how to fix this other than using isis 1.4.

Cheers,
Birgit


Re: Isis 1.5 and blobs with jdo/postgresql

Posted by xj...@nurfuerspam.de.
Hi Dan,

> "Dan Haywood" <da...@haywood-associates.co.uk> wrote 
> If you need anything in 1.5.0 (and can't use because of this issue) then
> your options are either to (a) build Isis from SNAPSHOT, see [2], or (b)
> temporarily switch to a different database, or (c) wait til the next
> release.

I guess we'll wait until the next release as long as we don't need anything from 1.5 - and then there's still option (a).
Thank you for looking into the issue and getting back to me so fast. :)

Cheers
Birgit



Re: Isis 1.5 and blobs with jdo/postgresql

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
OK, I've looked into this issue.

The long and short of it is that I need to make a fix on our
IsisBlobMapping class; I've raised a ticket for this [1] which has
additional detail of the problem and the fix.

If you need anything in 1.5.0 (and can't use because of this issue) then
your options are either to (a) build Isis from SNAPSHOT, see [2], or (b)
temporarily switch to a different database, or (c) wait til the next
release.

HTH

Dan

[1] https://issues.apache.org/jira/browse/ISIS-812
[2] http://isis.apache.org/contributors/building-isis.html



On 16 June 2014 18:57, Dan Haywood <da...@haywood-associates.co.uk> wrote:

> Hi Birgit,
> thanks for reporting this issue.
>
> Yes, you are right that in ISIS-714 changes were made here.  Previously we
> were (wrongly) storing Blobs as a serialized Java object.  As of 1.5 I used
> the IsisBlobMapping to explicitly map the three fields of an Isis blob (or
> clob), specifically its name, attachment and the byte[] array itself.
>
> Clearly the mapping in the quickstart app isn't quite generic enough for
> this to work on all databases.
>
> I'm hoping the fix will be a slightly adjusted JDO mappings for different
> databases.
>
> Let me look into it and get back to you.
>
> Thanks again
>
> Dan
>
>
>
>
>
> On 16 June 2014 16:35, <xj...@nurfuerspam.de> wrote:
>
>> Hi,
>>
>> I tried to use isis 1.5. instead of 1.4 in our app and ran into some
>> exceptions because of blobs (we use postgresql 9). Then I tried it with a
>> fresh ToDoApp and the same thing happened. I removed the comments from the
>> lines for PostgreSQL Server in persistor.properties, commented out the
>> lines for HSQLDB and created an empty db named isis. Running the
>> ToDoApp-PROTOTYPE-with-fixtures.launch first logs two warnings:
>>
>> [Schema main WARN ]  Attempt to find JDBC driver 'typeInfo' for
>> jdbc-type=BLOB but sql-type=BLOB is not found. Using default sql-type for
>> this jdbc-type.
>> [Schema main WARN ]  Attempt to find JDBC driver 'typeInfo' for
>> jdbc-type=CLOB but sql-type=CLOB is not found. Using default sql-type for
>> this jdbc-type
>>
>> and then the exception
>>
>> [FixturesInstallerDelegate main ERROR]  installing fixture
>> fixture.todo.scenarios.RecreateToDoItemsForSven failed; aborting
>> javax.jdo.JDODataStoreException: Insert of object
>> "dom.todo.ToDoItem@367a1d62" using statement "INSERT INTO "ToDoItem"
>> ("ownedBy","notes","cost","complete","subcategory","description","doc_name","doc_mimetype","doc_chars","category","attachment_name","attachment_mimetype","attachment_bytes","dueBy","version")
>> VALUES
>> (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" failed : FEHLER: Spalte
>> »attachment_bytes« hat Typ bytea, aber der Ausdruck hat Typ oid
>>   Hinweis: Sie müssen den Ausdruck umschreiben oder eine Typumwandlung
>> vornehmen.
>>   Position: 263
>>         at
>> org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:451)
>>         at
>> org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:732)
>>         at
>> org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:752)
>>         at
>> org.apache.isis.objectstore.jdo.datanucleus.persistence.commands.DataNucleusCreateObjectCommand.execute(DataNucleusCreateObjectCommand.java:54)
>> .......
>> Caused by: org.postgresql.util.PSQLException: FEHLER: Spalte
>> »attachment_bytes« hat Typ bytea, aber der Ausdruck hat Typ oid
>>   Hinweis: Sie müssen den Ausdruck umschreiben oder eine Typumwandlung
>> vornehmen.
>>   Position: 263
>>         at
>> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
>> .....
>>
>> The error message translates to
>> "ERROR: Column "attachment_bytes" is of type bytea but expression is of
>> type oid.
>>
>> I read something about a fixed blob/clob mapping (ISIS-714) on the blog.
>> Is this exception a datanucleus issue?
>> Right now I have no idea how to fix this other than using isis 1.4.
>>
>> Cheers,
>> Birgit
>>
>>
>

Re: Isis 1.5 and blobs with jdo/postgresql

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Birgit,
thanks for reporting this issue.

Yes, you are right that in ISIS-714 changes were made here.  Previously we
were (wrongly) storing Blobs as a serialized Java object.  As of 1.5 I used
the IsisBlobMapping to explicitly map the three fields of an Isis blob (or
clob), specifically its name, attachment and the byte[] array itself.

Clearly the mapping in the quickstart app isn't quite generic enough for
this to work on all databases.

I'm hoping the fix will be a slightly adjusted JDO mappings for different
databases.

Let me look into it and get back to you.

Thanks again

Dan





On 16 June 2014 16:35, <xj...@nurfuerspam.de> wrote:

> Hi,
>
> I tried to use isis 1.5. instead of 1.4 in our app and ran into some
> exceptions because of blobs (we use postgresql 9). Then I tried it with a
> fresh ToDoApp and the same thing happened. I removed the comments from the
> lines for PostgreSQL Server in persistor.properties, commented out the
> lines for HSQLDB and created an empty db named isis. Running the
> ToDoApp-PROTOTYPE-with-fixtures.launch first logs two warnings:
>
> [Schema main WARN ]  Attempt to find JDBC driver 'typeInfo' for
> jdbc-type=BLOB but sql-type=BLOB is not found. Using default sql-type for
> this jdbc-type.
> [Schema main WARN ]  Attempt to find JDBC driver 'typeInfo' for
> jdbc-type=CLOB but sql-type=CLOB is not found. Using default sql-type for
> this jdbc-type
>
> and then the exception
>
> [FixturesInstallerDelegate main ERROR]  installing fixture
> fixture.todo.scenarios.RecreateToDoItemsForSven failed; aborting
> javax.jdo.JDODataStoreException: Insert of object
> "dom.todo.ToDoItem@367a1d62" using statement "INSERT INTO "ToDoItem"
> ("ownedBy","notes","cost","complete","subcategory","description","doc_name","doc_mimetype","doc_chars","category","attachment_name","attachment_mimetype","attachment_bytes","dueBy","version")
> VALUES
> (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" failed : FEHLER: Spalte
> »attachment_bytes« hat Typ bytea, aber der Ausdruck hat Typ oid
>   Hinweis: Sie müssen den Ausdruck umschreiben oder eine Typumwandlung
> vornehmen.
>   Position: 263
>         at
> org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:451)
>         at
> org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:732)
>         at
> org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:752)
>         at
> org.apache.isis.objectstore.jdo.datanucleus.persistence.commands.DataNucleusCreateObjectCommand.execute(DataNucleusCreateObjectCommand.java:54)
> .......
> Caused by: org.postgresql.util.PSQLException: FEHLER: Spalte
> »attachment_bytes« hat Typ bytea, aber der Ausdruck hat Typ oid
>   Hinweis: Sie müssen den Ausdruck umschreiben oder eine Typumwandlung
> vornehmen.
>   Position: 263
>         at
> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
> .....
>
> The error message translates to
> "ERROR: Column "attachment_bytes" is of type bytea but expression is of
> type oid.
>
> I read something about a fixed blob/clob mapping (ISIS-714) on the blog.
> Is this exception a datanucleus issue?
> Right now I have no idea how to fix this other than using isis 1.4.
>
> Cheers,
> Birgit
>
>