[ http://issues.apache.org/jira/browse/IBATIS-351?page=all ]

Clinton Begin closed IBATIS-351.
--------------------------------

    Resolution: Invalid
      Assignee: Clinton Begin

There are already two solutions to this, both of which I find more appropriate 
than the one suggested.  

1) Don't map primitives to nullable columns << PREFERRED

2) Use a nullValue setting in your result map, that's what it's for.

Clinton

> Primitive argument type cannot be null(in PropertyAccessPlan. setProperties)
> ----------------------------------------------------------------------------
>
>                 Key: IBATIS-351
>                 URL: http://issues.apache.org/jira/browse/IBATIS-351
>             Project: iBatis for Java
>          Issue Type: Bug
>          Components: SQL Maps
>    Affects Versions: 2.1.7, 2.2.0
>            Reporter: qxo
>         Assigned To: Clinton Begin
>
> ResultObject  has a Primitive attribute and its result value is null,has 
> problem.
> I fixed this proble as follow:
> public void setProperties(Object object, Object[] values) {
>       int i = 0;
>     try {
>       Object[] arg = new Object[1];
>       for (i = 0; i < propertyNames.length; i++) {
>         arg[0] = values[i];
>         try {
>               final Class[] parameterTypes = setters[i].getParameterTypes();
>               if( null == arg[0] && parameterTypes[0].isPrimitive()){
>                       //FIXME Primitive argument type cannot be null
>                       return;
>               }
>           setters[i].invoke(object, arg);
>         } catch (Throwable t) {
>           throw ClassInfo.unwrapThrowable(t);
>         }
>       }
>     } catch (Throwable t) {
>       throw new RuntimeException("Error setting property '" + 
> setters[i].getName() + "' of '" +
>                                            object + "'.  Cause: " + t, t);
>     }
>   }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to