错误1:
org.mybatis.spring.MyBatisSystemException: nested exception isorg.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'userIds' in 'class java.lang.String'
这个userIds并不在UserEntity中存在,而userId是存在的,如果使用UserEntity中不存在userIds的属性 所以会报此错误。改成userId 问题即可解决。
解决方案二:
出现原因
这里出现的问题是在DAO方法中定义的参数 与 实体中定义的属性不一致 导致的。
解决方案:
dao层加@Param("userIds")注解即可
public List<DictItem> selectKeyByUserId(@Param("userIds") long userIds);
错误2:
nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
错误之处可能有以下几个:
1、没有加载mapper文件:
[html] view plain copy
<mappers>
<mapper resource="mappers/CaptchaMapper.xml" />
</mappers>
2、接口路径写错了:
[html] view plain copy
<!-- 这里namespace必须是接口的路径,不然要运行的时候要报错 “is not known to the MapperRegistry”-->
<mapper namespace="com.zc.beauty.dao.ICaptchaMapper">
3、方法名写错了:
[html] view plain copy
<!-- 这里的id必须和接口中的方法名相同,不然运行的时候也要报错 -->
<insert id="savePhoneCode" parameterType="com.zc.beauty.model.PhoneCaptcha">
insert into phone_captcha(u_phone, c_phonecode, c_sendtime) values(#{u_phone}, #{c_phonecode}, #{c_sendtime})
</insert>
4、没有 <!-- 数据映射器类 mapper bean -->
[html] view plain copy
<bean id="CaptchaMapper" class="org.mybatis.spring.mapper.MapperFactoryBean" >
<property name="sqlSessionFactory" ref="SqlSessionFactory" />
<property name="mapperInterface" value="com.zc.beauty.dao.ICaptchaMapper" />
</bean>
错误3
### The error may involve com.kanq.app.dao.LocationDao.writeLocation-Inline
### The error occurred while setting parameters
### SQL: insert into clocation (x,y,z,user id,ctime,devicename,userid) values (?, ?, ?, to_date(?,'yyyy-MM-dd hh24:mi:ss'), ?, ?);
insert into hislocation (x,y,z,userid,ctime,devicename,userid) values (?, ?, ?, to_date(?,'yyyy-MM-dd hh24:mi:ss'), ?, ? )
### Cause: java.sql.SQLException: ORA-01747: user.table.column, table.column 或列说明无效
解决方案:
多条insert语句分开执行。