This article is generated by AI translation.
Introduction
dbVisitor is a database access library that provides unified access to multiple different types of databases for Java. Its goal is to use a single set of APIs to access all databases.
dbVisitor is built on top of JDBC. It improves the low-level JDBC interface to provide a more natural API.
It consists of three parts:
- dbvisitor: The core module, providing a unified access API for multiple different types of databases.
- dbvisitor-integration: The integration module for dbVisitor with mainstream frameworks. Supports Spring/SpringBoot, Solon, Hasor, Guice.
- dbvisitor-adapter: The module for JDBC driver adapters, used to connect to databases such as NoSQL. For example: Redis, MongoDB, ElasticSearch.
It is not an ORM framework.
- dbVisitor is a library that facilitates Java access to databases. Although it is somewhat similar to ORM, there are still many differences compared to a true ORM philosophy.
dbVisitor is simple; it focuses on database access. Any specific functions with specific business meanings do not belong to dbVisitor. Nevertheless, you can still leverage this ingenious API design to meet specific business needs.
Why use it?
In the past, when relational databases were dominant, data access methods had become diverse and a large number of mature JDBC-based tools 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 data access technologies such as Hibernate, MyBatis, Spring JDBC, etc., mainly target relational databases and show limitations when facing increasingly diverse non-relational storage.
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 and non-relational storage.
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, MongoDB and ElasticSearch.
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.
- jdbc-elastic: A JDBC driver adapter for ElasticSearch, allowing developers to operate the database using standard JDBC interfaces and ElasticSearch QueryDSL.
Version Events
- Current latest version v6.7.0 (2026-02-14)
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 Fluent API — 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)