Sql 映射文件

来源:互联网 发布:淘宝店铺收藏怎么做 编辑:程序博客网 时间:2024/05/16 18:35

1、连接DB数据库的参数来自properties对象

  public SqlSessionFactory build(InputStream inputStream, Properties properties) {    return build(inputStream, null, properties);  }

2、<resultmap>标签

  表中字段的名称和实体类中属性的名称不一致

<resultMap type="entity.Userinfo" id="userinfo"><result column="id" property="idghy" /><result column="username" property="usernameghy" /><result column="password" property="passwordghy" /><result column="age" property="ageghy" /><result column="insertdate" property="insertdateghy" /></resultMap>

3、<sql>标签

 解决sql语句重复的问题


4、将sql 语句作为字符串变量传入











0 0