You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@metamodel.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/11/01 07:53:58 UTC

[jira] [Commented] (METAMODEL-1127) PostgreSQL error when inserting null MAP (json(b)) value

    [ https://issues.apache.org/jira/browse/METAMODEL-1127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15624683#comment-15624683 ] 

ASF GitHub Bot commented on METAMODEL-1127:
-------------------------------------------

Github user LosD commented on the issue:

    https://github.com/apache/metamodel/pull/135
  
    LGTM!


> PostgreSQL error when inserting null MAP (json(b)) value
> --------------------------------------------------------
>
>                 Key: METAMODEL-1127
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-1127
>             Project: Apache MetaModel
>          Issue Type: Bug
>            Reporter: Kasper Sørensen
>            Assignee: Kasper Sørensen
>
> In an application we are building I have seen this exception thrown:
> {code}
> 21:48:09.894 [XNIO-1 task-2] WARN  o.a.m.j.d.PostgresqlQueryRewriter - Exception occurred while calling setNull(...) for value index 7. Attempting value-based setter method instead.
> java.lang.IllegalStateException: Could not access fields in JdbcTypes
>         at org.apache.metamodel.schema.ColumnTypeImpl.getJdbcType(ColumnTypeImpl.java:156)
>         at org.apache.metamodel.jdbc.dialects.AbstractQueryRewriter.setStatementParameter(AbstractQueryRewriter.java:320)
>         at org.apache.metamodel.jdbc.dialects.PostgresqlQueryRewriter.setStatementParameter(PostgresqlQueryRewriter.java:102)
>         at org.apache.metamodel.jdbc.JdbcInsertBuilder.execute(JdbcInsertBuilder.java:79)
>         at org.apache.metamodel.insert.InsertInto.run(InsertInto.java:70)
>         at org.apache.metamodel.jdbc.JdbcDataContext.executeUpdate(JdbcDataContext.java:846)
> ...
> Caused by: java.lang.IllegalStateException: No JdbcType found with field name: MAP
>         at org.apache.metamodel.schema.ColumnTypeImpl.getJdbcType(ColumnTypeImpl.java:154)
>         ... 46 common frames omitted
> {code}
> After debugging it I can see that it is happening because we are trying to insert a null value for a MAP column (of native type 'jsonb').
> Looking at PostgresqlQueryRewriter.setStatementParameter(...) it seems this class or JdbcUtils is the culprit.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)