Mybatis-Error setting null parameter

前端 未结 2 1078
梦毁少年i
梦毁少年i 2020-12-31 06:10

I used mybatis-spring-1.0.3-SNAPSHOT mybatis-3.0.6 spring3.0.6.I tried to delete record from a table like this:

        

        
2条回答
  •  悲哀的现实
    2020-12-31 06:38

    OK I see a few problems. First, when setting a null parameter into a Prepared Statement or a Callable Statement MyBatis needs to know the jdbc type. Like this,

    #{myNullParamenter, jdbcType=VARCHAR}
    

    You're also generating your 'in clause incorrectly. You need to use the foreach tag to only generate list of the values. Move the "ID IN" part out of the foreach tag.

    
        ID IN
        
            #{id}
        
    
    

    I would also recommend against using HashMaps. The new Mapper classes are much better.

提交回复
热议问题