ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

[mybatis]Configuration XML_settings

2022-01-22 20:33:10  阅读:35  来源: 互联网

标签:XML String settings private 设置 mybatis Configuration id name


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映射上了!

标签:XML,String,settings,private,设置,mybatis,Configuration,id,name
来源: https://blog.csdn.net/m0_51955470/article/details/122641531

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有