DEV.co
Open-Source Databases · yulichang

mybatis-plus-join

MyBatis-Plus-Join is a Java ORM extension that adds multi-table join support (LEFT JOIN, RIGHT JOIN, etc.) to MyBatis-Plus with a fluent, lambda-style API. It simplifies complex SQL queries while maintaining MyBatis-Plus conventions and is published to Maven Central.

Source: GitHub — github.com/yulichang/mybatis-plus-join
1.5k
GitHub stars
154
Forks
Java
Primary language
Apache-2.0
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositoryyulichang/mybatis-plus-join
Owneryulichang
Primary languageJava
LicenseApache-2.0 — OSI-approved
Stars1.5k
Forks154
Open issues54
Latest releasev1.5.7 (2026-04-16)
Last updated2026-07-02
Sourcehttps://github.com/yulichang/mybatis-plus-join

What mybatis-plus-join is

A MyBatis-Plus interceptor/wrapper library that extends MPJBaseMapper with MPJLambdaWrapper for type-safe, chainable join operations. It generates SQL at runtime, supports pagination via MyBatis-Plus plugins, and requires MyBatis-Plus 3.1.2+. Works with MySQL, PostgreSQL, and other SQL dialects.

Quickstart

Get the mybatis-plus-join source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/yulichang/mybatis-plus-join.gitcd mybatis-plus-join# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Multi-table reporting queries

Simplify JOIN-heavy reports and dashboards without hand-written SQL. Use lambda chains to select specific columns from multiple tables and apply complex WHERE clauses across joined tables.

RESTful API layer queries

Build paginated API endpoints that combine data from related tables (e.g., users with addresses, orders with items). Lambda syntax keeps controller/service code clean and maintainable.

Data migration and batch operations

Migrate data across schema versions or build ETL pipelines where you need to JOIN and transform multiple source tables into a DTO without writing raw SQL.

Implementation considerations

  • Ensure MyBatis-Plus 3.1.2+ and pagination plugin (if pagination is needed) are configured before enabling mybatis-plus-join. Verify database dialect support (MySQL and PostgreSQL confirmed in docs).
  • DTOs for result mapping must match selected columns; mismatch will cause runtime failures. Use @TableField annotations or alias naming carefully to avoid column name conflicts in joins.
  • Test lambda expressions with actual queries; syntax errors or incorrect field references may only surface during query execution, not compile time.
  • Monitor performance of generated SQL; complex joins with many WHERE clauses can produce verbose queries. Consider database indexes on join keys and filter columns.
  • Familiarize team with MPJLambdaWrapper API and join method signatures (leftJoin, rightJoin, etc.) to avoid common mistakes like incorrect join condition ordering.

When to avoid it — and what to weigh

  • Non-relational or document-based databases — This library targets SQL databases only (MySQL, PostgreSQL). Not suitable for MongoDB, DynamoDB, or other NoSQL stores.
  • Graph-heavy or recursive queries — If you need deep hierarchical traversal (e.g., org trees, graph walks), raw SQL or a graph database is clearer. JOINs alone become unwieldy.
  • Team unfamiliar with MyBatis-Plus — Adds an additional abstraction layer on top of MyBatis-Plus. Teams new to MyBatis-Plus will face a steeper learning curve; consider simpler ORM alternatives if onboarding speed is critical.
  • Extremely high-scale or complex schema evolution — While functional, dynamically generated SQL at runtime may not optimize as well as hand-tuned queries for large-scale systems. Schema refactoring can become fragile if many lambda chains depend on column structure.

License & commercial use

Licensed under Apache License 2.0 (Apache-2.0), an OSI-approved permissive license permitting commercial use, modification, and distribution with attribution and liability/warranty disclaimers.

Apache 2.0 is a permissive open-source license that explicitly allows commercial use without royalty or proprietary restrictions. Typical obligations: include a copy of the license and notice any modifications. Consult legal counsel if bundling proprietary software; no guarantee is provided by the licensor.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

Standard SQL injection risks apply if user input is passed unsanitized into lambda expressions. Use parameterized conditions (e.g., eq, like with placeholder values) consistently. No explicit security audit data provided. Verify that MyBatis-Plus 3.1.2+ version does not have known CVEs. Single-author maintenance model may delay security patches.

Alternatives to consider

MyBatis-Plus native BaseMapper with XML

Use raw XML mappers for complex multi-table queries if you prefer explicit SQL control and do not want additional abstraction. Less convenient but more predictable for intricate joins.

Hibernate/JPA with @OneToMany/@ManyToOne

Heavier ORM with built-in entity relationships and lazy loading. Handles complex object graphs automatically but trades performance predictability for ease of use.

QueryDSL or jOOQ

Type-safe, code-generation-based query builders for Java. More mature ecosystem, better IDE support, and broader database support, but heavier dependency and learning curve.

Software development agency

Build on mybatis-plus-join with DEV.co software developers

Evaluate MyBatis-Plus-Join against your ORM requirements. Check the wiki documentation, review the demo project, and assess join complexity in your codebase. For custom integration or migration planning, consult a specialist.

Talk to DEV.co

Related 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-plus-join FAQ

Does MyBatis-Plus-Join support INNER JOIN, FULL OUTER JOIN, etc.?
README explicitly mentions LEFT JOIN and RIGHT JOIN. Full list of supported join types (INNER, FULL OUTER, CROSS) not clearly stated; requires checking wiki documentation or source code.
Can I use MyBatis-Plus-Join with Spring Boot and existing MyBatis-Plus code?
Yes. Install boot-starter, extend mappers from MPJBaseMapper, and use alongside existing Base mapper methods. No breaking changes to MyBatis-Plus configuration required.
What happens if my DTO field names don't match joined table columns?
Runtime mapping failure. Use MyBatis-Plus @TableField annotations or explicit select() calls with aliases to map column names to DTO fields correctly.
Is there a limit on the number of tables I can JOIN?
No explicit limit stated in provided data. Practical limit depends on SQL database and query complexity. Test with your schema; deeply nested joins may degrade performance.

Custom software development services

DEV.co is a software development agency delivering custom software development services to companies building on open source. Our software developers and web developers design, integrate, and ship production systems — spanning web development, APIs, AI, data, and cloud. If mybatis-plus-join is part of your open-source databases roadmap, our team can implement, customize, migrate, and maintain it.

Ready to streamline multi-table queries in your MyBatis-Plus project?

Evaluate MyBatis-Plus-Join against your ORM requirements. Check the wiki documentation, review the demo project, and assess join complexity in your codebase. For custom integration or migration planning, consult a specialist.