A Read‑Only ORM That’s 100× Faster Than MyBatis
BeanSearcher, a read‑only Java ORM, generates SQL from declarative annotations and maps HTTP query parameters directly to query conditions, allowing complex multi‑table, aggregation and sorting queries with a single line of code and claiming performance up to a hundred times faster than MyBatis.
BeanSearcher is a read‑only ORM for Java that focuses on complex list queries such as multi‑condition filtering, multi‑table joins, pagination, sorting, and aggregation. It enables a single entity to map to multiple tables, supports dynamic field operators, group aggregation, sub‑queries, SQL interceptors, multiple data sources, and optional custom annotations.
Technical principle
Declarative annotations are processed at runtime to generate SQL statements, and HTTP request parameters are mapped directly to query conditions. This approach supplements MyBatis’s CRUD capabilities without replacing them, providing a read‑only path for complex queries.
Quick start
Add the Maven dependency to a Spring Boot project:
implementation 'cn.zhxu:bean-searcher-boot-stater:4.8.7'Inject BeanSearcher into a controller and invoke a single search call:
return beanSearcher.search(User.class,
MapUtils.flat(request.getParameterMap()),
new String[]{"age"});A request such as
?status=1&name=Jack&name-ic=true&sort=age&order=descfilters by status, performs a case‑insensitive search on name, sorts by age descending, and adds an aggregation of the age field. The same result that would normally require extensive MyBatis XML and mapper code is produced with a single line, which the author claims reduces roughly 80 % of query work to one statement.
Repository
GitHub: https://github.com/troyzhxu/bean-searcher
Conclusion
For Java back‑ends that frequently encounter complex list‑query scenarios, BeanSearcher can compress the majority of query logic into a single call, offering a substantial efficiency gain while remaining a read‑only complement to existing MyBatis usage.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Architect's Tech Stack
Java backend, microservices, distributed systems, containerized programming, and more.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
