resultType:直接表示返回类型 resultMap:对外部resultMap的引用 二者不能同时使用 创建一个实体类Role和User public class Role { private Integer id; private String roleCode; private String roleName; //省略set.get方法 创建User类(在User中有roleId 1对多关系) public class User { private Integer id; pri
最近接触了一个类似于代码生成工具的活.思路是,通过java的反射机制得到类的字段和字段类型, 从而可以创建一个map集合存储表名(由类名决定的特殊结构字符串),表字段(由类变量确定),表字段类型(由变量类型确定),DAO中通过将map传递给mybatis,在mybatis 中调用存储过程生成表. 1,在数据库中添加一个存储过程,如下 sp_createTable BEGIN ); DROP TABLE IF EXISTS p_name; SET sql_text=CONCAT('CREATE T
报错信息如下: Could not set parameters for mapping: ParameterMapping{property='age', mode=IN, javaType=class java.lang.Integer, jdbcType=null org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set