LIYUANWAI的gravatar头像
LIYUANWAI 2018-07-03 09:45:43

mybatis抛出异常JDBC requires that the JdbcType must be specified for all nullable parameters.

问题描述

在查询某个部门信息的时候报错。错在sql某个值null时需配jdbcType,查了些资料出现这种问题都是插入,但是查询还是报这个问题,而后我在字段里面加了写ifnull 还是报一样的错误。求解。。

运行环境

jdk7+tomcat6

项目技术(必填)

mybatis

项目截图(必填)

mybatis抛出异常JDBC requires that the JdbcType must be specified for all nullable parameters.

运行截图(必填)

mybatis抛出异常JDBC requires that the JdbcType must be specified for all nullable parameters.

相关代码片段

/*执行sql*/

<select id="assessmentList" resultType="com.orhon.pa.modules.opa.entity.OpaLeadershipAssessment">

SELECT

a.id AS "id",

a.office_id AS "office.id",

a.item_parent_id AS "itemParentId",

a.code AS "code",

a.name AS "name",

a.create_by AS "createBy.id",

a.create_date AS "createDate",

a.update_by AS "updateBy.id",

a.update_date AS "updateDate",

a.remarks AS "remarks",

a.del_flag AS "delFlag",

a.democratic_assessment AS "democraticAssessment",

a.social_assessment AS "socialAssessment",

a.germany_assessment AS "germanyAssessment",

a.conversation_assessment AS "conversationAssessment",

a.department_assessment AS "departmentAssessment",

a.normal_assessment AS "normalAssessment",

a.status AS "status",

ifnull(SUM(

a.DEMOCRATIC_ASSESSMENT + 

    a.SOCIAL_ASSESSMENT +

    a.GERMANY_ASSESSMENT +

    a.CONVERSATION_ASSESSMENT + 

    a.NORMAL_ASSESSMENT + 

    a.DEPARTMENT_ASSESSMENT

),"")AS allscore,

IFNULL(a.user_id,"") AS userId

FROM opa_leadership_assessment a

<where>

a.del_flag = #{DEL_FLAG_NORMAL} 

and a.user_id=#{id}

<if test="name != null and name != ''">

AND a.name LIKE 

<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>

<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>

<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>

</if>

</where>

<choose>

<when test="page !=null and page.orderBy != null and page.orderBy != ''">

ORDER BY ${page.orderBy}

</when>

<otherwise>

<!-- ORDER BY a.update_date DESC -->

group by name

                order by allscore 

</otherwise>

</choose>

</select>

注意事项

所有回答列表(1)
别了不想说的gravatar头像
别了不想说  LV4 2018年7月3日

传入的参数为空

评论(2) 最佳答案
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友