[mybatis]Configuration XML_settings

settings

[mybatis]Configuration XML_settings

  • settings包含很多重要的设置项
    • setting:用来设置每一个设置项
    • name:设置项名
    • value:设置项取值

mapUnderscoreToCamelCase

  • 开启驼峰命名法
  <settings>
        <setting name="mapUnderscoreToCamelCase" value="true"/>
    </settings>

Employee:

package com.atguigu.mybatis.bean;


public class Employee {

    private Integer id;
    private String lastName;
    private String email;
    private String gender;
}
   

EmployeeMapper.xml:

<?xml version="1.0" encoding="UTF-8" ?>
        <!DOCTYPE mapper
                PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.atguigu.mybatis.dao.EmployeeMapper">



<select id="getEmpById" resultType="com.atguigu.mybatis.bean.Employee">

    select id,last_name ,email,gender from tb1_employee where id = #{id}

</select>
</mapper>

bean的lastName可以与数据库的last_name映射上了!

上一篇:AcWing 848.有向图的拓扑序列


下一篇:com.jsoniter.spi.JsonException: readString: expect string or null, but ?, head: 4, peek: