Skip to main content
Hint

This article is generated by AI translation.

Object Mapping

dbVisitor only does Object Mapping, not relational mapping (one-to-one, one-to-many, many-to-many, etc.). Java objects map directly to database tables/views, and database dialect differences can be abstracted away with the Fluent API.

Quick Example
@Table("users")
public class User {
@Column(name = "id", primary = true, keyType = KeyType.Auto)
private Long id;
@Column("name")
private String name;
}

Mapping Configuration

  • Annotations, use @Table and @Column annotations to declare mappings.
  • Mapper File, configure mappings via the <entity> tag in mapper XML.
  • Key Generators, support sequences, UUID, auto-increment key backfill, and more.
  • Type Handling, type mapping for enums, JSON, and special JDBC types.

Tips

  • Camel Case, automatically map Java camel-case property names to database underscore column names.
  • Name Sensitivity, handle case sensitivity and database reserved words in column names.
  • Write Policy, control whether property values participate in INSERT / UPDATE operations.
  • Statement Templates, handle special SQL scenarios in Fluent API (e.g., MySQL Point type).