## 1. Database Persistence Architecture

![Database Persistence Architecture](https://www.fastbee.cn/doc/assets/database001.BeSp8wg1.png)

## 2. Database Components

### 2.1 Druid

Druid is the best database connection pool in the Java language. Druid provides powerful monitoring and extension features.

* GitHub: [Druid](https://github.com/alibaba/druid)
* Documentation: [Druid](https://github.com/alibaba/druid/wiki/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98)

### 2.2 MyBatis-Plus

MyBatis-Plus is an enhancement tool for MyBatis. It only enhances MyBatis without changing it, and is designed to simplify development and improve efficiency.

* GitHub: [MyBatis-Plus](https://github.com/baomidou/mybatis-plus)
* Documentation: [MyBatis-Plus](https://baomidou.com/)

### 2.3 dynamic-datasource

dynamic-datasource-spring-boot-starter is a Spring Boot based starter for quickly integrating multiple data sources.

* GitHub: [dynamic-datasource](https://github.com/baomidou/dynamic-datasource)
* Documentation: [dynamic-datasource](https://www.kancloud.cn/tracy5546/dynamic-datasource/2264611)
* Examples: [dynamic-datasource](https://github.com/dynamic-datasource/dynamic-datasource-samples)

### 2.4 ShardingSphere

Apache ShardingSphere is a distributed SQL transaction and query engine that can enhance any database with capabilities such as data sharding, elastic scaling, and encryption.

* GitHub: [ShardingSphere](https://github.com/apache/shardingsphere)
* Documentation: [ShardingSphere](https://shardingsphere.apache.org/)
* Examples: [ShardingSphere](https://github.com/apache/shardingsphere/tree/master/examples)

### 2.5 AnyLine

The core of AnyLine is a (No-ORM) database operation tool based on the spring-jdbc ecosystem. It abandons the tedious and rigid Service/Dao/Entity/\*O/Mapper layers — no MyBatis, no various configurations, no various \*O objects.

* GitHub: [AnyLine](https://gitee.com/anyline/anyline)
* Documentation: [AnyLine](http://doc.anyline.org/ss/82_p298pn6e9o1r5gv78acvic1e624c62387f51d08504f16eef5da3b7873deb47b935)
* Examples: [AnyLine](https://gitee.com/anyline/anyline-simple)

## 3. Secondary Development Reading Suggestions

Database development should not focus only on persistence layer components. You also need to evaluate the impact scope together with business tables, APIs, and frontend pages.

| Scenario | Recommended Document |
| --- | --- |
| Look up tables by business | [Data Model And API Map](https://www.fastbee.cn/doc/en/business/v2/dev/data-model-map.html) |
| Look up modules by API | [Backend Module Map](https://www.fastbee.cn/doc/en/business/v2/dev/backend-module-map.html) |
| Look up data architecture | [Data and Database Architecture](https://www.fastbee.cn/doc/en/business/v2/architecture/data.html) |
| Look up frontend integration | [Vue3 Frontend Development And Integration](https://www.fastbee.cn/doc/en/business/v2/dev/vue3-development.html) |

## 4. SQL Modification Notes

* Adding a new field requires synchronizing the Domain, Mapper, VO/DTO, frontend forms, and import/export logic.
* For multi-database editions, the Dameng, Kingbase, Oracle, Postgres, and SQL Server scripts must be synchronized.
* High-frequency device data should prefer the time-series database path; do not write to MySQL without restraint.
* For tables involving tenants and data permissions, query conditions must also handle the organization and user scope.
* Upgrade scripts must be rehearsed on a test database before going live, and a rollback plan must be prepared.
