mybatis-3
MyBatis is a mature Java SQL mapper framework that lets developers write SQL directly while mapping results to Java objects. It simplifies database interaction by avoiding heavy ORM overhead, making it popular for teams that prefer explicit SQL control.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | mybatis/mybatis-3 |
| Owner | mybatis |
| Primary language | Java |
| License | Apache-2.0 — OSI-approved |
| Stars | 20.4k |
| Forks | 12.9k |
| Open issues | 216 |
| Latest release | mybatis-3.5.19 (2025-01-02) |
| Last updated | 2026-07-08 |
| Source | https://github.com/mybatis/mybatis-3 |
What mybatis-3 is
MyBatis provides XML or annotation-based SQL mapping with automatic result-to-object binding, supporting stored procedures, parameterized queries, and dynamic SQL. It operates as a lightweight alternative to full ORMs, giving developers low-level SQL control while automating object hydration.
Get the mybatis-3 source
Clone the repository and explore it locally.
git clone https://github.com/mybatis/mybatis-3.gitcd mybatis-3# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Developers must write and maintain explicit SQL mappings (XML or annotations); test coverage for queries is essential to catch errors early.
- Result mapping requires careful type alignment between database columns and Java properties; mismatch handling defaults to null rather than strict validation.
- Dynamic SQL construction in MyBatis uses expression language; improper use can introduce SQL injection vulnerabilities if user input is not properly parameterized.
- Caching strategy (session vs. app-level) must be designed upfront; default behavior is per-session, which can mask stale data if not configured deliberately.
- Integration with Spring or other frameworks is common; ensure chosen version and ecosystem (Spring Data MyBatis, MyBatis-Plus) matches your stack.
When to avoid it — and what to weigh
- No SQL Expertise on Team — If your team lacks SQL proficiency or prefers object-centric domain modeling, a full ORM (Hibernate, JPA) may reduce friction and boilerplate.
- Database Portability is Critical — MyBatis requires explicit SQL for each database engine; projects needing multi-database support will need to maintain parallel SQL definitions, increasing maintenance burden.
- Rapid Prototyping or Startup Mode — Writing and maintaining XML or annotation mappings adds overhead in early-stage projects; a code-first ORM may accelerate initial delivery.
- Heavy Entity Relationships — Projects with deep object graphs and complex lazy-loading requirements may benefit more from a full ORM that automates relationship fetching and cycle prevention.
License & commercial use
MyBatis is licensed under Apache License 2.0 (Apache-2.0), an OSI-approved permissive license permitting commercial use, modification, and distribution with minimal restrictions.
Apache-2.0 is widely accepted for commercial applications. No license review required for standard business use; include a copy of the license in distributions. Consult your legal team if deploying as a managed service or modifying the framework core.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Adequate |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Strong |
| Assessment confidence | High |
MyBatis itself does not validate queries; SQL injection risk is present if user input is concatenated rather than parameterized (use ${} only for column/table names, use #{} for values). No explicit security audit data provided; consult latest GitHub advisories and security policy. Dependency vulnerabilities possible; maintain up-to-date transitive dependencies via Maven/Gradle lock files.
Alternatives to consider
Hibernate / JPA
Full ORM offering automatic relationship management, lazy loading, and query generation; adds abstraction layer and memory overhead but reduces SQL maintenance.
jOOQ
Type-safe SQL builder with database-portable DSL; appealing to teams seeking SQL control without raw string mapping or to avoid dialect switching.
Spring Data JDBC
Lightweight Spring abstraction over JDBC with minimal magic; simpler than MyBatis for basic CRUD but less flexible for complex queries and mapping.
Build on mybatis-3 with DEV.co software developers
Contact us to discuss integration strategy, SQL mapping patterns, and team readiness. We help teams assess whether MyBatis or an alternative ORM best fits your architecture and constraints.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
mybatis-3 FAQ
Does MyBatis handle transactions?
Can I use MyBatis with Spring Boot?
How does MyBatis compare to writing raw JDBC?
Is MyBatis suitable for microservices?
Software developers & web developers for hire
Adopting mybatis-3 is usually one piece of a larger software development effort. As a software development agency, DEV.co provides software development services and web development expertise — pairing senior software developers and web developers with your team to design, build, and operate open-source databases software in production.
Ready to evaluate MyBatis for your project?
Contact us to discuss integration strategy, SQL mapping patterns, and team readiness. We help teams assess whether MyBatis or an alternative ORM best fits your architecture and constraints.