Hint
This article is generated by AI translation.
Auto-mapping
<resultMap> and <entity> enable auto-mapping by default via autoMapping.
With auto-mapping you do not need to declare each column; dbVisitor maps properties by predefined rules.
以 <resultMap> 标签为例
<resultMap id="userResultMap"
type="com.example.dto.UserBean"
autoMapping="true"/> <!-- 默认 autoMapping 属性为 true 可不配置 -->
Two notes
- If
<resultMap>or<entity>contains anyid/result/mappingentries, auto-mapping is disabled. - If a property has
@Column, it is mapped regardless ofautoMapping.
Camel case
Databases often use uppercase and underscores, which differs from Java camelCase. Use mapUnderscoreToCamelCase to bridge this.
以 <resultMap> 标签为例
<resultMap id="userResultMap"
type="com.example.dto.UserBean"
mapUnderscoreToCamelCase="true"/>