You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Bekkum Odd-Rune <Od...@imr.no> on 2010/03/16 13:34:20 UTC

setNull and default jdbcType

Hi.

I've used ibatis 2.3.4, and are now starting to use 3.0.
I'm using Postgres 8.4.

I'm trying to figure out why I have to specify jdbcType on those columns that can be set to null.
Why was the default "Types.OTHER" removed?

Version 2.3.4:
from ParameterMap.java
      if (jdbcType != JdbcTypeRegistry.UNKNOWN_TYPE) {
        ps.setNull(i + 1, jdbcType);
      } else {
        ps.setNull(i + 1, Types.OTHER);
      }

Version 3.0.242:
from BaseTypeHandler.java
    if (parameter == null) {
      if (jdbcType == null) {
        throw new TypeException("JDBC requires that the JdbcType must be specified for all nullable parameters.");
      }
      ps.setNull(i, jdbcType.TYPE_CODE);
    } else {
      setNonNullParameter(ps, i, parameter, jdbcType);
    }

Thanks,
Odd-Rune.

SV: setNull and default jdbcType

Posted by Bekkum Odd-Rune <Od...@imr.no>.
Looks good.

Thanks
orb
________________________________
Fra: Clinton Begin [clinton.begin@gmail.com]
Sendt: 17. mars 2010 05:28
Til: user-java@ibatis.apache.org
Emne: Re: setNull and default jdbcType

Fixed.  Give it a try.

Clinton

On Tue, Mar 16, 2010 at 12:28 PM, Bekkum Odd-Rune <Od...@imr.no>> wrote:
Hi.

To get it to work I've added :OTHER on all INSERT and UPDATE statements.
I can do check out and build and test it tomorrow.
I've created Jira ticket IBATIS-762.

Thanks,
Odd-Rune.

Thanks.  A few others have reported this, but until now I didn't understand what was happening.  It's unusual for Postgres to allow Types.OTHER for setNull.  Indeed I did remove that code.  I don't think it should be a problem to put it back.  I'll try to commit something tonight, and if you're willing to check out from SVN and do a build to test it out, that would be great.

If you get a chance, could you file a Jira ticket for this?

Thanks much,
Clinton

On Tue, Mar 16, 2010 at 6:34 AM, Bekkum Odd-Rune <Od...@imr.no>>> wrote:
Hi.

I’ve used ibatis 2.3.4, and are now starting to use 3.0.
I’m using Postgres 8.4.

I’m trying to figure out why I have to specify jdbcType on those columns that can be set to null.
Why was the default “Types.OTHER” removed?

Version 2.3.4:
from ParameterMap.java
     if (jdbcType != JdbcTypeRegistry.UNKNOWN_TYPE) {
       ps.setNull(i + 1, jdbcType);
     } else {
       ps.setNull(i + 1, Types.OTHER);
     }

Version 3.0.242:
from BaseTypeHandler.java
   if (parameter == null) {
     if (jdbcType == null) {
       throw new TypeException("JDBC requires that the JdbcType must be specified for all nullable parameters.");
     }
     ps.setNull(i, jdbcType.TYPE_CODE);
   } else {
     setNonNullParameter(ps, i, parameter, jdbcType);
   }

Thanks,
Odd-Rune.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org<ma...@ibatis.apache.org>
For additional commands, e-mail: user-java-help@ibatis.apache.org<ma...@ibatis.apache.org>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: setNull and default jdbcType

Posted by Clinton Begin <cl...@gmail.com>.
Fixed.  Give it a try.

Clinton

On Tue, Mar 16, 2010 at 12:28 PM, Bekkum Odd-Rune <Od...@imr.no>wrote:

> Hi.
>
> To get it to work I've added :OTHER on all INSERT and UPDATE statements.
> I can do check out and build and test it tomorrow.
> I've created Jira ticket IBATIS-762.
>
> Thanks,
> Odd-Rune.
>
> Thanks.  A few others have reported this, but until now I didn't understand
> what was happening.  It's unusual for Postgres to allow Types.OTHER for
> setNull.  Indeed I did remove that code.  I don't think it should be a
> problem to put it back.  I'll try to commit something tonight, and if you're
> willing to check out from SVN and do a build to test it out, that would be
> great.
>
> If you get a chance, could you file a Jira ticket for this?
>
> Thanks much,
> Clinton
>
> On Tue, Mar 16, 2010 at 6:34 AM, Bekkum Odd-Rune <Odd-Rune.Bekkum@imr.no
> <ma...@imr.no>> wrote:
> Hi.
>
> I’ve used ibatis 2.3.4, and are now starting to use 3.0.
> I’m using Postgres 8.4.
>
> I’m trying to figure out why I have to specify jdbcType on those columns
> that can be set to null.
> Why was the default “Types.OTHER” removed?
>
> Version 2.3.4:
> from ParameterMap.java
>      if (jdbcType != JdbcTypeRegistry.UNKNOWN_TYPE) {
>        ps.setNull(i + 1, jdbcType);
>      } else {
>        ps.setNull(i + 1, Types.OTHER);
>      }
>
> Version 3.0.242:
> from BaseTypeHandler.java
>    if (parameter == null) {
>      if (jdbcType == null) {
>        throw new TypeException("JDBC requires that the JdbcType must be
> specified for all nullable parameters.");
>      }
>      ps.setNull(i, jdbcType.TYPE_CODE);
>    } else {
>      setNonNullParameter(ps, i, parameter, jdbcType);
>    }
>
> Thanks,
> Odd-Rune.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

RE: setNull and default jdbcType

Posted by Bekkum Odd-Rune <Od...@imr.no>.
Hi.

To get it to work I've added :OTHER on all INSERT and UPDATE statements.
I can do check out and build and test it tomorrow.
I've created Jira ticket IBATIS-762.

Thanks,
Odd-Rune.

Thanks.  A few others have reported this, but until now I didn't understand what was happening.  It's unusual for Postgres to allow Types.OTHER for setNull.  Indeed I did remove that code.  I don't think it should be a problem to put it back.  I'll try to commit something tonight, and if you're willing to check out from SVN and do a build to test it out, that would be great.

If you get a chance, could you file a Jira ticket for this?

Thanks much,
Clinton

On Tue, Mar 16, 2010 at 6:34 AM, Bekkum Odd-Rune <Od...@imr.no>> wrote:
Hi.

I’ve used ibatis 2.3.4, and are now starting to use 3.0.
I’m using Postgres 8.4.

I’m trying to figure out why I have to specify jdbcType on those columns that can be set to null.
Why was the default “Types.OTHER” removed?

Version 2.3.4:
from ParameterMap.java
      if (jdbcType != JdbcTypeRegistry.UNKNOWN_TYPE) {
        ps.setNull(i + 1, jdbcType);
      } else {
        ps.setNull(i + 1, Types.OTHER);
      }

Version 3.0.242:
from BaseTypeHandler.java
    if (parameter == null) {
      if (jdbcType == null) {
        throw new TypeException("JDBC requires that the JdbcType must be specified for all nullable parameters.");
      }
      ps.setNull(i, jdbcType.TYPE_CODE);
    } else {
      setNonNullParameter(ps, i, parameter, jdbcType);
    }

Thanks,
Odd-Rune.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: setNull and default jdbcType

Posted by Clinton Begin <cl...@gmail.com>.
Thanks.  A few others have reported this, but until now I didn't understand
what was happening.  It's unusual for Postgres to allow Types.OTHER for
setNull.  Indeed I did remove that code.  I don't think it should be a
problem to put it back.  I'll try to commit something tonight, and if you're
willing to check out from SVN and do a build to test it out, that would be
great.

If you get a chance, could you file a Jira ticket for this?

Thanks much,
Clinton

On Tue, Mar 16, 2010 at 6:34 AM, Bekkum Odd-Rune <Od...@imr.no>wrote:

>  Hi.
>
>
>
> I’ve used ibatis 2.3.4, and are now starting to use 3.0.
>
> I’m using Postgres 8.4.
>
>
>
> I’m trying to figure out why I have to specify jdbcType on those columns
> that can be set to null.
>
> Why was the default “Types.OTHER” removed?
>
>
>
> Version 2.3.4:
>
> from ParameterMap.java
>
>       if (jdbcType != JdbcTypeRegistry.UNKNOWN_TYPE) {
>
>         ps.setNull(i + 1, jdbcType);
>
>       } else {
>
>         ps.setNull(i + 1, Types.OTHER);
>
>       }
>
>
>
> Version 3.0.242:
>
> from BaseTypeHandler.java
>
>     if (parameter == null) {
>
>       if (jdbcType == null) {
>
>         throw new TypeException("JDBC requires that the JdbcType must be
> specified for all nullable parameters.");
>
>       }
>
>       ps.setNull(i, jdbcType.TYPE_CODE);
>
>     } else {
>
>       setNonNullParameter(ps, i, parameter, jdbcType);
>
>     }
>
>
>
> Thanks,
>
> Odd-Rune.
>