Mysql-Mybatis使用,记一次 Statement returned more than one row, where no more than one was expected.
原因: <association property="name" select="com.mybatisDao.selectDeptNameByUserid" column="ID"/>
采用了** association** 级联,查询出的结果为两个"name",但是对象只能接受一个"name";报错:Statement returned more than one row, where no more than one was expected.
解决:如果不需要 association 级联的字段,可以自己重新写一个resultMap,或者修改sql,让其只获得一个"name"