Hint
This article is generated by AI translation.
Auto-mapping
<resultMap> and <entity> tags enable auto-mapping by default via the autoMapping attribute.
With auto-mapping, you do not need to declare a mapping for each column; dbVisitor automatically discovers type properties and maps them to columns based on predefined rules.
Example with <resultMap> tag
<resultMap id="userResultMap"
type="com.example.dto.UserBean"
autoMapping="true"/> <!-- autoMapping defaults to true, so it can be omitted -->
Two notes
- If
<resultMap>or<entity>contains anyid/result/mappingchild tags, auto-mapping is disabled and only manually declared column mappings are used. - If a property has
@Column, it is mapped regardless of theautoMappingvalue.
Camel Case
Database columns typically use uppercase letters and underscores, which differs from Java's camelCase convention. Use mapUnderscoreToCamelCase to bridge this difference.
Example with <resultMap> tag
<resultMap id="userResultMap"
type="com.example.dto.UserBean"
mapUnderscoreToCamelCase="true"/>