Result Maps collection does not contain value for com.example.wahaha.mapper.DrinkEntityMapper.BaseResultMap
原因1: com.example.wahaha.mapper.DrinkEntityMapper.BaseResultMap确实找不到,配置的路径不对
原因2:多数据源下,SqlSessionTemplate中的sqlSessionFactory引叉了
使用mybatis generator生成的mapper,在使用mysql数据库时
inset后会调刚刚插入的id
@SelectKey(statement="CALL IDENTITY()", keyProperty="id", before=false, resultType=Integer.class)
int insert(MonoEntity record);
但是mysql并不支持,会报 PROCEDURE table.IDENTITY does not exist
改为如下即可
@SelectKey(statement="select last_insert_id()", keyProperty="id", before=false, resultType=Integer.class)
int insert(MonoEntity record);
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
select last_insert_id()
</selectKey>