# dbvisitor
**Repository Path**: hlx_coltd/dbvisitor
## Basic Information
- **Project Name**: dbvisitor
- **Description**: dbVisitor 是一个数据库 ORM工具,提供对象映射、丰富的类型处理、动态SQL、存储过程、内置分页方言20+、支持嵌套事务、多数据源、条件构造器、INSERT 策略、多语句/多结果。兼容 Spring 及 MyBatis 用法。它不依赖任何其它框架,因此可以很方便的和任意一个框架整合在一起使用。
- **Primary Language**: Java
- **License**: Apache-2.0
- **Default Branch**: main
- **Homepage**: https://www.dbvisitor.net/
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 80
- **Created**: 2023-03-24
- **Last Updated**: 2023-03-24
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
介绍
------------------------------------
``Documents are translated using translation software, The original for README.md``
* Project Home: [https://www.dbvisitor.net](https://www.dbvisitor.net)
* [](https://qm.qq.com/cgi-bin/qm/qr?k=Qy3574A4VgI0ph4fqFbZW-w49gnyqu6p&jump_from=webapi)
[](mailto:zyc@byshell.org)
[](https://www.apache.org/licenses/LICENSE-2.0.html)
[](https://maven-badges.herokuapp.com/maven-central/net.hasor/dbvisitor)
dbVisitor is a database orm tool, Providing object mapping,Richer type handling than Mybatis,
Dynamic SQL, stored procedures, more dialect 20+, nested transactions, multiple data sources, conditional constructors,
INSERT strategies, multiple statements/multiple results. And compatible with Spring and MyBatis usage.
It doesn't depend on any other framework, so it can be easily integrated with any framework.
Features
------------------------------------
- Familiar
- JdbcTemplate(like Spring JDBC)
- Mapper files(Compatible with most MyBatis)
- LambdaTemplate (Close to the MyBatis Plus、jOOQ and BeetlSQL)
- @Insert、@Update、@Delete、@Query、@Callable (like JPA)
- Transaction support
- Support for 5 transaction isolation levels, 7 transaction propagation behaviors (same as Spring TX)
- provides TransactionTemplate and TransactionManager transaction control (same usage as Spring)
- Feature
- Support for paging queries and multiple database dialects (20+)
- Support for INSERT strategies (INTO, UPDATE, IGNORE)
- Richer TypeHandler(MyBatis 40+,dbVisitor 60+)
- Mapper file supports multiple statements and multiple results
- provides special '@{XXX, expr, XXXXX}' rule extension mechanism to make dynamic SQL simpler
- Support for stored procedures
- Supports time types in JDBC 4.2 and Java8
- Support for multiple data sources
Quick Start
------------------------------------
dependency
```xml
net.hasordbvisitor5.2.0
```
database drivers, for example:
```xml
mysqlmysql-connector-java8.0.22
```
dbVisitor can be used without relying on database connection pools,
but having a database connection pool is standard for most projects. Druid of Alibaba
```xml
com.alibabadruid1.1.23
```
Finally, prepare a database table and initialize some data ('createdB.sql' file)
```sql
drop table if exists `test_user`;
create table `test_user` (
`id` int(11) auto_increment,
`name` varchar(255),
`age` int,
`create_time` datetime,
primary key (`id`)
);
insert into `test_user` values (1, 'mali', 26, now());
insert into `test_user` values (2, 'dative', 32, now());
insert into `test_user` values (3, 'jon wes', 41, now());
insert into `test_user` values (4, 'mary', 66, now());
insert into `test_user` values (5, 'matt', 25, now());
```
### using SQL
```java
// creating a data source
DataSource dataSource = DsUtils.dsMySql();
// create JdbcTemplate object
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
// load the test data script
jdbcTemplate.loadSQL("CreateDB.sql");
// Query the data and return it as a Map
List