5

mybatis | xml 的 property 和 column

 1 year ago
source link: https://benpaodewoniu.github.io/2023/02/04/java226/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

mybatis | xml 的 property 和 column

我们在定义 xml 的时候,经常这样定义。

<resultMap type="com.fate.backstage.entity.user.UserInfo" id="UserInfo">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="password" column="password"/>
<result property="nickName" column="nickName"/>
<result property="email" column="email"/>
<result property="token" column="token"/>
<result property="erc20_address" column="erc20_address"/>
<result property="create_time" column="create_time"/>
</resultMap>
  • column
    • 对应我们数据库表中的字段名称
  • property
    • 对应我们的实体类的属性,比如:User中的属性userName,要和数据库表m_user中的name对应

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK