ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: Inherited getter and inline parameter map => NullPointerException
Date Wed, 14 May 2008 21:32:40 GMT
OK - we need to see the SQL map (just the update) and the two Java classes.
Hopefully they are not too big :)

Jeff Butler

On Wed, May 14, 2008 at 3:46 PM, Thiago F. G. Albuquerque <tfga@mpdft.gov.br>
wrote:

> Version 2.3.0.677.
>
> Jeff Butler wrote:
>
>> What version of iBATIS are you using?  I have tests with this exect
>> scenario working now.
>>  Jeff Butler
>>
>>  On Wed, May 14, 2008 at 2:40 PM, Thiago F. G. Albuquerque <
>> tfga@mpdft.gov.br <mailto:tfga@mpdft.gov.br>> wrote:
>>
>>    Hi,
>>
>>    When I have a inherited getter in the domain object and the
>>    corresponding attribute appears in an inline parameter map, I get a
>>    NullPointerException:
>>
>>    Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
>>  --- The error occurred in Evento.abator.sqlmap.xml.  --- The error
>>    occurred while applying a parameter map.  --- Check the
>>    Evento.abatorgenerated_updateByPrimaryKey-InlineParameterMap.  ---
>>    Check the parameter mapping for the 'codigo' property.  --- Cause:
>>    java.lang.NullPointerException
>>           at
>>
>>  com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:94)
>>           at
>>
>>  com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.update(SqlMapExecutorDelegate.java:505)
>>           at
>>
>>  com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.update(SqlMapSessionImpl.java:90)
>>           at
>>
>>  org.springframework.orm.ibatis.SqlMapClientTemplate$10.doInSqlMapClient(SqlMapClientTemplate.java:384)
>>           at
>>
>>  org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:194)
>>           ... 56 more
>>    Caused by: java.lang.NullPointerException
>>           at
>>
>>  com.ibatis.sqlmap.engine.mapping.parameter.BasicParameterMap.setParameter(BasicParameterMap.java:165)
>>           at
>>
>>  com.ibatis.sqlmap.engine.mapping.parameter.BasicParameterMap.setParameters(BasicParameterMap.java:125)
>>           at
>>
>>  com.ibatis.sqlmap.engine.execution.SqlExecutor.executeUpdate(SqlExecutor.java:79)
>>           at
>>
>>  com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteUpdate(GeneralStatement.java:200)
>>           at
>>
>>  com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:78)
>>           ... 60 more
>>
>>    Here is BasicParameterMap.java:165:
>>
>>      // Set Parameter
>>      TypeHandler typeHandler = mapping.getTypeHandler();
>>      if (value != null) {
>>    =>    typeHandler.setParameter(ps, i + 1, value,
>>    mapping.getJdbcTypeName()); // <= typeHandler == null !
>>      } else if (typeHandler instanceof CustomTypeHandler) {
>>        typeHandler.setParameter(ps, i + 1, value,
>>    mapping.getJdbcTypeName());
>>      } else {
>>
>>    When I overwrite the getter in the subclass, the error disappears.
>>    Maybe iBatis can't get the return type of inherited methods and, as
>>    a result, can't resolve the type handler?
>>
>>    Regards,
>>    Thiago
>>
>>
>>
>

Mime
View raw message