mybatis的resultMap property爆红

2023-05-16

 <resultMap id="userMap" type="com.cast.pojo.User">
        <id column="id" property="userId"/>
        <result column="username" property="userName"/>
        <result column="sex" property="userSex"/>
        <result column="birthday" property="userBirthday"/>
        <result column="address" property="userAddress"/>
    </resultMap>

mybatis的resultMap property爆红
虽然我写了全路径类名,但是就是不能找到实体类的属性,最后的原因,就是在SQL的配置文件sqlMapperConfig.xml中添加别名,而且要写在环境的上边,写下下边configuration爆红

 <!-- 设置别名  name后面的包名是你自己的-->
  <typeAliases>
        <typeAlias type="com.cast.pojo.User" alias="user"/>
    </typeAliases>
   
 <!--配置全貌-->

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-config.dtd">

<configuration>

    <!-- 设置别名  name后面的包名是你自己的-->
  <typeAliases>
        <typeAlias type="com.cast.pojo.User" alias="user"/>
    </typeAliases>

    <environments default="mysql">
        <environment id="mysql">
            <transactionManager type="JDBC"></transactionManager>
            <dataSource type="POOLED">
                <property name="driver" value="com.mysql.jdbc.Driver"/>
                <property name="url" value="jdbc:mysql://localhost:3306/mybatis"/>
                <property name="username" value="root"/>
                <property name="password" value="654321"/>
            </dataSource>
        </environment>
    </environments>

    <!--配置映射文件-->
    <mappers>
        <mapper resource="com/cast/dao/UserDao.xml"></mapper>
    </mappers>

</configuration>

最后不要忘了,修改映射文件Daomapper.xml中的路径
直接写别名,全路径已经换为别名了

<resultMap id="userMap" type="user">
        <id column="id" property="userId"/>
        <result column="username" property="userName"/>
        <result column="sex" property="userSex"/>
        <result column="birthday" property="userBirthday"/>
        <result column="address" property="userAddress"/>
    </resultMap>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

mybatis的resultMap property爆红 的相关文章

随机推荐

  • react异步数据如ajax请求应该放在哪个生命周期?

    对于同步的状态改变 xff0c 是可以放在componentWillMount xff0c 对于异步的 xff0c 最好好放在componentDidMount 但如果此时有若干细节需要处理 xff0c 比如你的组件需要渲染子组件 xff0
  • RabbitMQ exchange交换机机制

    目录 RabbitMQ 概念exchange交换机机制 什么是交换机binding xff1f Direct Exchange交换机Topic Exchange交换机Fanout Exchange交换机Header Exchange交换机R
  • 解决open-vm-tools无法复制粘贴文件问题

    在使用vmware kali linux时一直忍受着一个情况 xff1a open vm tools Error when getting information for file 34 tmp VMwareDnD 3jTONh xxx N
  • mipmap 和 drawable 的区别

    Android 在 API level 17 加入了 mipmap 技术 xff0c 对 bitmap 图片的渲染支持 mipmap 技术 xff0c 来提高渲染的速度和质量 mipmap 是一种很早就有的技术了 xff0c 翻译过来就是纹
  • LSTM与GRU

    LSTM 与 GRU 一 综述 LSTM 与 GRU是RNN的变种 xff0c 由于RNN存在梯度消失或梯度爆炸的问题 xff0c 所以RNN很难将信息从较早的时间步传送到后面的时间步 LSTM和GRU引入门 xff08 gate xff0
  • Pytorch 实战RNN

    一 简单实例 span class token comment coding utf8 span span class token keyword import span torch span class token keyword as
  • Pytorch : Dataset和DataLoader

    一 综述 Dataset 对数据进行抽象 xff0c 将数据包装为Dataset类 DataLoader 在 Dataset之上对数据进行进一步处理 xff0c 包括进行乱序处理 xff0c 获取一个batch size的数据等 二 Dat
  • 特征工程

    一 数据读取 1 1 读取CSV文件 1 1 1 原文件内容 1 1 2 读取csv span class token keyword import span csv csv file span class token operator 6
  • 代码命名规范

    代码命名规范 现在是2016年12月30日中午12点35分 xff0c 这是我第一次写博客 xff0c 用的是markdown编辑器 xff0c 还不太会用 今天就先简单的写一下 xff0c 看看写出来的效果是什么样的 xff01 xff0
  • Ubuntu18.04 离线安装nginx

    由于服务器位于内网环境且无法访问互联网 xff0c 需要离线安装nginx xff0c ubuntu18 04离线安装软件也并不复杂 xff0c 只是需要较大的耐心去搜集所需的包 xff0c 不过大家不用担心 xff0c 我已经为大家准备好
  • easyui combobox动态绑定数据

    1 jsp上的写法 lt input span class hljs keyword class span 61 span class hljs string 34 easyui combobox 34 span id 61 span cl
  • Echarts(二、柱状图(各参数详细描述))

    1 jsp页面 span class hljs tag lt span class hljs title body span gt span span class hljs tag lt span class hljs title div
  • js中级脚本算法

    1区间求值算法挑战 span class hljs function span class hljs keyword function span span class hljs title sumAll span span class hl
  • 常用easyUI -icon 图标

    1 样式 代码 xff1a lt DOCTYPE html gt lt html lang 61 34 en 34 gt lt head gt lt meta charset 61 34 UTF 8 34 gt lt title gt Ea
  • vue与后台交互数据(vue-resource)

    需要引入库 xff1a vue resource lt script src 61 34 https cdn jsdelivr net vue resource 1 0 3 vue resource min js 34 gt lt scri
  • Tensorflow——jupyter notebook调用某个库时,出现找不到这个库情况的解决方案

    1 激活tensorflow环境 终端下输入 xff1a source activate tensorflow 2 进入jupyter notebook 出现如下问题 xff1a 没有找到matplotlib库 3 解决方法 在tensor
  • 组合排序题目汇总(排列组合、卡特兰数和递归思想)

    组合排序题目汇总 排列组合矩阵走法A必须在B左边站队互不相邻站队分糖果球放入桶吃糖 卡特兰数括号匹配进出栈顺序 售票顺序二叉树不同的结构数高矮排列 递归思想信封装信 排列组合 矩阵走法 在6 9的方格中 xff0c 以左上角为起点 xff0
  • java.lang.IllegalStateException 错误原因及解决方法小记

    java lang IllegalStateException Cannot perform this operation because the connection pool has been closed at android dat
  • 架构设计三原则

    1 简单原则 xff1b 分析完业务场景的结构复杂性和逻辑复杂性后 xff0c 从业务场景和解决问题的角度出发 xff0c 选择和设计能够满足需求的方案 在简单架构和复杂架构都能满足要求的时候 xff0c 优先选择简单架构 xff0c 因为
  • mybatis的resultMap property爆红

    span class token tag span class token tag span class token punctuation lt span resultMap span span class token attr name