MyBatis links Java objects to SQL and stored procedures via XML or annotations. It trims repetitive JDBC parameter and result handling.
Overview
MyBatis is a persistence layer for Java that connects object-oriented application code to relational databases. It maps primitives, maps, and POJOs to rows using SQL you define, rather than driving every query through a heavy object–relational mapping layer.
You configure statements with XML descriptors or annotations. The framework runs custom SQL and stored procedures and supports advanced result mappings while taking care of much of the JDBC wiring.
Project documentation describes it as a persistence framework focused on simplicity compared with full ORM tooling. It targets teams that want explicit SQL with structured mapping into Java types.
Manual and translated guides cover setup, statement mapping, and how MyBatis fits alongside other database access options in Java applications.
Key features
- Custom SQL and stored procedures
- XML or annotation configuration
- POJO and map result mapping
- Reduced JDBC boilerplate
- Advanced mapping support
- Primitive type mapping
- Object–SQL coupling
- Persistence-focused API
Use cases
- Java apps with hand-written SQL
- Mapping query results to POJOs
- Calling stored procedures from Java
- Replacing verbose JDBC code
- Explicit SQL with structured mappings