This article is generated by AI translation.
Introduction
dbVisitor is a database access library that provides unified api to access databases for Java, making data reading and writing more natural.
dbVisitor is built based on JDBC, It has improved the underlying JDBC interface, thereby providing a more concise and unified API.
It consists of three parts:
- dbvisitor: The core module, providing a unified access API for multiple different types of databases.
- dbvisitor-integration: the module for dbVisitor with integration frameworks. It supports integration as Spring/SpringBoot、Solon、 Hasor、Guice, etc.
- dbvisitor-adapter: The module for JDBC driver adapters, Used for connect to NoSQL databases such as Redis and MongoDB.
It is Not a ORM Framework.
- dbVisitor is a library that facilitates Java access to databases. Although it is somewhat similar to ORM, there are many differences.
dbVisitor is simple; it focuses on database access. Any specific functions with specific business meanings do not belong to dbVisitor. Nevertheless, you can still use the ingenious api design to meet specific business needs.
Why use it?
In the past, when relational databases popularity, data access methods became diverse and a large number of mature tools based on JDBC emerged. However, with the rise of NoSQL databases, data storage forms became more diverse and access APIs became more complex. Developers need to switch between different APIs, increasing learning costs and usage difficulty.
Existing library such as Hibernate, MyBatis, Spring JDBC, etc., mainly target relational databases and show limitations when facing increasingly diverse NoSQL databases.
The core breakthrough of dbVisitor lies in the seamless integration of access modes: developers can mix multiple access paradigms in the same project and obtain a unified experience between relational databases and NoSQL databases.
In terms of API design, dbVisitor provides APIs with a style similar to Spring JdbcTemplate, MyBatis. This design allows developers to avoid accepting a large number of new concepts and knowledge, thereby reducing learning costs and usage difficulty.
Using dbVisitor
- dbVisitor uses the commercially friendly Apache 2.0 license.
- dbVisitor only has one dependency, Cobble (cobble is a toolkit similar to Apache Commons or Guava).
- All dbVisitor modules and dependencies can be obtained through Maven Central.
JVM Compatibility
dbVisitor can run on all Java 8 or higher versions, and all versions are compiled and built using Java 8.
Getting Started
- dbVisitor supports accessing the database using the Programmatic API via raw SQL.
- dbVisitor supports accessing the database using the Declarative API by marking interfaces with annotations.
- dbVisitor supports accessing all framework-supported databases with the same API using the Fluent API method.
- dbVisitor supports simplifying applications by performing routine operations on the database through predefined methods in BaseMapper.
- dbVisitor supports unified management of SQL statements using Mapper XML files.
- dbVisitor provides multiple ways to handle Arguments, believing that a suitable way can always be found to handle them in various special scenarios.
- dbVisitor provides a more flexible and efficient Rule mechanism, which makes maintaining application SQL more concise.
- dbVisitor has built-in multiple Type Handlers, which can conveniently handle most database types.
- dbVisitor supports using Transactions between multiple different method calls.
- dbVisitor uses a unified API to operate non-relational databases Redis and MongoDB.
Integration
- dbvisitor-spring: Supports automatic configuration and injection of dbVisitor configured Mappers and instances in Spring 4.x and Spring Boot 2, Spring Boot 3.
- dbvisitor-solon: Supports automatic configuration and injection of dbVisitor configured Mappers and instances in applications using Solon as the application development framework.
- dbvisitor-hasor: Supports automatic configuration and injection of dbVisitor configured Mappers and instances in applications using Hasor as the application development framework.
- dbvisitor-guice: Supports automatic configuration and injection of dbVisitor configured Mappers and instances in applications using Google Guice dependency injection.
- jdbc-redis: A JDBC driver adapter for Redis, allowing developers to operate the database using standard JDBC interfaces and Redis commands.
- jdbc-mongo: A JDBC driver adapter for MongoDB, allowing developers to operate the database using standard JDBC interfaces and MongoDB commands.
Version Events
- Current latest version v6.3.1 (2025-12-13)
6.xversion is a brand new upgrade. While inheriting the functions of 5.x, it has made major improvements to the implementation of different style APIs to keep usage and behavior unified in all aspects.5.xversion dbVisitor was officially separated from the Hasor framework and provides three different styles of APIs: Programmatic API, Declarative API, and Constructor to access the database.4.xand earlier versions did not have their own independent versions, and their release followed the Hasor framework release.
Contact Author
- Code Repository: Gitee, Github
- Issue: Gitee
- QQ Group: 948706820 (dbVisitor QQ Group 1)