On this page
Overview
MyBatis is a Java SQL mapper framework that connects SQL defined in XML or annotations with parameter binding and result mapping into Java objects.
Features and best fit
Based on official documentation; not hands-on tested · Content checked:
Key features
Map SQL statements to Java methods explicitly
Mapper interfaces plus XML or annotations connect SQL, parameters, and result mappings.
Reduce JDBC boilerplate without hiding the SQL
Applications retain control of SQL while the framework handles repetitive statement and result-mapping work.
Sources: [4]
Best fit
Fits Java applications that want SQL to remain reviewable
It works well with existing schemas and database-specific SQL when teams want less mapping code but explicit queries.
Sources: [4]
Before adoption
Its design differs from query-generating ORMs
The application still owns SQL design, indexing decisions, and transaction boundaries.
Sources: [4]
Official sources
- [1]mybatis/mybatis-3 repository(2026-09-30)
- [2]MyBatis README(2026-09-30)
- [3]MyBatis 3.5.19 release(2026-09-30)
- [4]MyBatis documentation(2026-09-30)
Supplemental curator note
MyBatis fits Java applications that want to keep SQL explicit while delegating parameter and result mapping to a framework. It is especially useful when SQL control matters more than ORM-style query generation.
Try it in 3 steps
- 1
Add MyBatis 3.5.19
Add the released artifact from Maven Central.
implementation("org.mybatis:mybatis:3.5.19") - 2
Define a mapper interface
Define the mapper method the application will call, adapting the Java or Kotlin signature to the project.
interface BlogMapper { fun selectBlog(id: Int): Blog } - 3
Add the SQL mapping
Map the SQL and result type in XML, then verify parameter binding and mapping against a real database.
<select id="selectBlog" resultType="Blog">SELECT * FROM blog WHERE id = #{id}</select>
Growth
Growth trends · Last 30 days
20,450 Stars
Trend data is still being collected.
Built with
Categories and tags
Categories
GitHub data
GitHub dataView detailed GitHub data
GitHub Topics
- java
- mybatis
- sql
- Stars
- 20,450
- Forks
- 12,848
- Watchers
- 1,129
- Open issues
- 212
- Owner type
- Organization
- Primary language
- Java
- License
- Apache-2.0
- Repository last updated
- Sep 19, 2026
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- Hibernate ORM6,471 Stars
2 shared tag(s) · 1 shared category(s) · Same language
manage Java entity state, transactions, queries, and database dialects through a Jakarta Persistence/JPA relational persistence framework
Java - Turso Database24,457 Stars
2 shared tag(s) · 1 shared category(s)
run SQLite-compatible SQL on a Rust database engine with bindings for multiple languages
Rust - Elasticsearch78,140 Stars
2 shared tag(s) · Same language
distributed full-text/vector search for analytics, observability, and RAG
Java - OpenSearch13,791 Stars
2 shared tag(s) · Same language
Support distributed full-text, analytics, observability, and vector search
Java - Flyway10,113 Stars
2 shared tag(s) · Same language
manage database schema changes as versioned migration code with tracked history
Java - Apache Spark44,088 Stars
2 shared tag(s)
Process SQL, DataFrames, streams, and machine learning on one distributed engine
Scala
Report incorrect information
Tell us if any listing information is incorrect or outdated.