ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Darek Dober" <doover...@op.pl>
Subject Re: Postgres - inserting null causes error - Unknown Types value
Date Wed, 14 Sep 2005 07:42:32 GMT
There was an error in my statement.
It should be like this, of course:)

insert into table(column)
values (#column:INTEGER#)

Darek
  ----- Original Message ----- 
  From: TNO 
  To: user-java@ibatis.apache.org 
  Sent: Wednesday, September 14, 2005 9:22 AM
  Subject: Re: Postgres - inserting null causes error - Unknown Types value


  This is much shorter...

  thanks Darek ;-) 



  Darek Dober a écrit : 
    I read somewhere in docs, that is caused because jdbc driver 8.xx is almost full implementation
of JDBC Type 3, which uses prepareStatement in contrast to jdbc driver 7.4.xx, which does
not. So you have to explicitly specify the JDBC-type as Niels said.

    You don't have to create parameterMap just specify the type like:

    insert into table(column)
    values (#column:INTEGER)

    which is much shorter:)

    Darek Dober
      ----- Original Message ----- 
      From: TNO 
      To: user-java@ibatis.apache.org 
      Sent: Tuesday, September 13, 2005 10:18 AM
      Subject: Re: Postgres - inserting null causes error - Unknown Types value


      To avoid this, I create a parameterMap for my insert and update.

      Niels Beekman a écrit : 
        I do not know PostgreSql very well, but could it be that you have to explicitly specify
the JDBC-type, as in Oracle?


        Niels



------------------------------------------------------------------------

        From: Zarar Siddiqi [mailto:zarar.siddiqi@utoronto.ca] 
        Sent: dinsdag 13 september 2005 15:15
        To: user-java@ibatis.apache.org
        Subject: Postgres - inserting null causes error - Unknown Types value


        I'm having a problem with iBatis using PostgreSql.


        I have an insert statment, "insertEndUser" which I pass an "EndUser" object to for
inserting.  If all the properties of the EndUser object are non-null, the insert works fine,
but if ANY of them are null, I get the following exception, (in this case "gender" was null).
 I'm using the Spring (1.2.4) framework and it's SqlMapClientTemplate class to do the insert.


        Any ideas of what might be wrong.  I was thinking of using a type handler to make
the mapping from null to empty String but this seems too trivial of a problem for it to require
extreme measures.  I'm migrating from MySql to PostgreSql and this was working just fine in
MySql.  


        Any input is appreciated. 




        org.springframework.jdbc.BadSqlGrammarException: SqlMapClient operation; bad SQL grammar
[]; nested exception is
        com.ibatis.common.jdbc.exception.NestedSQLException:
        --- The error occurred in com/_8020/mcc/dao/ibatis/sql/EndUserSQL.xml.
        --- The error occurred while applying a parameter map.
        --- Check the insertEndUser-InlineParameterMap.
        --- Check the parameter mapping for the 'gender' property.
        --- Cause: org.postgresql.util.PSQLException: Unknown Types value.
        com.ibatis.common.jdbc.exception.NestedSQLException:
        --- The error occurred in com/company/dummy/dao/ibatis/sql/EndUserSQL.xml.
        --- The error occurred while applying a parameter map.
        --- Check the insertEndUser-InlineParameterMap.
        --- Check the parameter mapping for the 'gender' property.
        --- Cause: org.postgresql.util.PSQLException: Unknown Types value.
        Caused by: org.postgresql.util.PSQLException: Unknown Types value. at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:87)
         at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:442)

------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.23/99 - Release Date: 12/09/2005
  



-- 
Il n'y a pas de mauvais langage, il n'y a que des bons programmeurs...
----------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.24/101 - Release Date: 13/09/2005

  



-- 
Il n'y a pas de mauvais langage, il n'y a que des bons programmeurs...


Mime
View raw message