# abel533/mapper

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/abel533-mapper).**

7,370 stars · 1,604 forks · Java · MIT

## Links

- GitHub: https://github.com/abel533/Mapper
- Homepage: https://mybatis.io
- awesome-repositories: https://awesome-repositories.com/repository/abel533-mapper.md

## Topics

`mapper` `mybatis` `mybatis-plugin`

## Description

Mapper is a MyBatis-specific library that provides annotation-driven object-relational mapping, enabling single-table CRUD operations without writing SQL or XML. It uses Java reflection and field-level annotations to map entity fields to database columns, configure primary key generation strategies, and generate mapper interfaces and model classes from database schemas.

The library distinguishes itself through several practical capabilities. It includes a safe operation guard that blocks delete and update calls lacking query conditions, preventing accidental full-table modifications. Its example object query builder constructs dynamic WHERE clauses by introspecting populated fields on a plain Example object, avoiding string concatenation. The generic base mapper pattern defines a parameterised base interface with common CRUD methods that concrete mappers inherit, eliminating repetitive method declarations. Developers can also register mapper interfaces automatically through annotations, extend base interfaces with custom methods, and replace default entity-to-table mapping logic with custom implementations.

Beyond its core identity, Mapper supports property-based queries that retrieve records based on specific entity property values, and provides code generation tools that produce mapper interfaces and model classes from database schema metadata. The library's configuration surface includes automatic mapper registration and customisable entity-to-table mapping resolution.

## Tags

### Data & Databases

- [MyBatis](https://awesome-repositories.com/f/data-databases/crud-operations/mybatis.md) — Provides single-table create, read, update, and delete operations on database tables without writing XML or SQL.
- [CRUD Operations](https://awesome-repositories.com/f/data-databases/crud-operations.md) — Executes common create, read, update, and delete operations on a single database table without writing SQL or XML. ([source](https://cdn.jsdelivr.net/gh/abel533/mapper@master/README.md))
- [Dangerous Operation Guards](https://awesome-repositories.com/f/data-databases/dangerous-operation-guards.md) — Intercepts delete and update calls to verify query conditions exist, preventing accidental full-table modifications.
- [Generic Base Mapper Interfaces](https://awesome-repositories.com/f/data-databases/data-mapping-engines/common-operation-mappers/generic-base-mapper-interfaces.md) — Provides a parameterised base mapper interface with common CRUD methods for inheritance.
- [Example-Based WHERE Clauses](https://awesome-repositories.com/f/data-databases/data-querying/dynamic-field-querying/example-based-where-clauses.md) — Builds dynamic WHERE clauses by populating fields on a plain Example object.
- [Annotation-Based Key Strategies](https://awesome-repositories.com/f/data-databases/entity-modeling/primary-keys/annotation-based-key-strategies.md) — Configures primary key generation strategies through custom annotations on entity fields. ([source](https://github.com/abel533/Mapper/wiki/4.x.changelog))
- [Annotation-Based Key Generation](https://awesome-repositories.com/f/data-databases/entity-modeling/primary-keys/key-generation-strategies/annotation-based-key-generation.md) — Provides annotation-based primary key generation strategy configuration on entity fields.
- [Annotation-Based Key Strategies](https://awesome-repositories.com/f/data-databases/entity-modeling/primary-keys/key-generation-strategies/annotation-based-key-strategies.md) — Configures primary key generation strategies through custom annotations on entity fields.
- [State Update Race Condition Prevention](https://awesome-repositories.com/f/data-databases/persistent-application-state/job-state-persistence/state-querying/atomic-state-updates/state-update-race-condition-prevention.md) — Blocks delete and update calls lacking query conditions to prevent accidental full-table modifications.
- [Example Object Database Queries](https://awesome-repositories.com/f/data-databases/semantic-search/code-search/example-based-code-queries/example-object-database-queries.md) — Builds dynamic WHERE clauses by populating fields on a plain Example object. ([source](https://github.com/abel533/Mapper/wiki))
- [Object Mappings](https://awesome-repositories.com/f/data-databases/table-definitions/object-mappings.md) — Declares how Java fields correspond to table columns, primary keys, and generation strategies through annotations. ([source](https://github.com/abel533/Mapper/wiki))
- [Example Object Query Builders](https://awesome-repositories.com/f/data-databases/task-result-storage/query-result-persistence/where-clause-builders/example-object-query-builders.md) — Builds dynamic WHERE clauses by populating fields on a plain Example object, avoiding hand-written SQL.
- [Example Object WHERE Clauses](https://awesome-repositories.com/f/data-databases/task-result-storage/query-result-persistence/where-clause-builders/example-object-where-clauses.md) — Builds dynamic WHERE clauses by introspecting populated fields on a plain Example object.
- [Annotation-Driven Mappings](https://awesome-repositories.com/f/data-databases/type-mapping-frameworks/script-to-native-type-mappings/entity-mappings/annotation-driven-mappings.md) — Declares how Java fields correspond to table columns, primary keys, and generation strategies through annotations.
- [Reflection-Based Mappings](https://awesome-repositories.com/f/data-databases/type-mapping-frameworks/script-to-native-type-mappings/entity-mappings/reflection-based-mappings.md) — Uses Java reflection at runtime to read entity annotations and build SQL statements dynamically.
- [Guarded](https://awesome-repositories.com/f/data-databases/delete-operations/guarded.md) — Blocks delete calls that lack query conditions, throwing an exception to avoid accidental full-table deletion. ([source](https://github.com/abel533/Mapper/wiki/4.x.changelog))
- [Entity Property Queries](https://awesome-repositories.com/f/data-databases/string-data-structures/property-querying/entity-property-queries.md) — Retrieves database records based on specific entity property values without writing SQL. ([source](https://github.com/abel533/Mapper/wiki/4.x.changelog))
- [Guarded](https://awesome-repositories.com/f/data-databases/update-operations/guarded.md) — Blocks update calls that lack query conditions, throwing an exception to avoid accidental full-table updates. ([source](https://github.com/abel533/Mapper/wiki/4.x.changelog))

### Development Tools & Productivity

- [Mapper Interface Generators](https://awesome-repositories.com/f/development-tools-productivity/annotation-driven-specification-generation/mapper-interface-generators.md) — Generates mapper interfaces and model classes from entity annotations and database schemas.

### Software Engineering & Architecture

- [Mapper Code Generators](https://awesome-repositories.com/f/software-engineering-architecture/schema-to-code-generators/mapper-code-generators.md) — Generates mapper interfaces and model classes from database schemas to eliminate boilerplate. ([source](https://github.com/abel533/Mapper/wiki))
- [MyBatis Mapper Code Generators](https://awesome-repositories.com/f/software-engineering-architecture/schema-to-code-generators/mybatis-mapper-code-generators.md) — Generates mapper interfaces and model classes from database schemas for MyBatis projects.
- [MyBatis Mapper Generators](https://awesome-repositories.com/f/software-engineering-architecture/schema-to-code-generators/mybatis-mapper-generators.md) — Generates mapper interfaces and model classes from database schemas to eliminate repetitive boilerplate code.
