https://github.com/future-architect/uroborosql
Developer-oriented and SQL centric database access library
https://github.com/future-architect/uroborosql
java java-library orm sql
Last synced: 9 months ago
JSON representation
Developer-oriented and SQL centric database access library
- Host: GitHub
- URL: https://github.com/future-architect/uroborosql
- Owner: future-architect
- License: mit
- Created: 2017-02-24T15:16:04.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2025-05-05T05:52:49.000Z (9 months ago)
- Last Synced: 2025-05-07T21:08:38.449Z (9 months ago)
- Topics: java, java-library, orm, sql
- Language: Java
- Homepage: https://future-architect.github.io/uroborosql-doc/
- Size: 2.54 MB
- Stars: 91
- Watchers: 16
- Forks: 8
- Open Issues: 2
-
Metadata Files:
- Readme: README.ja.md
- License: LICENSE
Awesome Lists containing this project
- awesome-java - UroboroSQL - way-SQL,由日本Future公司开源。 (数据库开发)
README
[](https://maven-badges.herokuapp.com/maven-central/jp.co.future/uroborosql) [](https://raw.githubusercontent.com/future-architect/uroborosql/master/LICENSE) [](https://www.javadoc.io/doc/jp.co.future/uroborosql) [](https://github.com/future-architect/uroborosql/actions/workflows/ci.yml) [](https://coveralls.io/github/future-architect/uroborosql?branch=master)
uroboroSQL
==========

uroboroSQLは、Java8対応の2Way-SQLが利用可能なシンプルなSQL実行ライブラリです。
uroboroSQLは主にSQL中心の設計コンセプトを採用しています。Javaを中心に考えてSQLを組み立てるという思想ではなく、SQLに足りないところをJavaで補うという思想です。
エンタープライズで培われたノウハウとして、区分値サポート、リトライ、フィルターによるカスタマイズなどの機能を充実させています。また、2Way-SQLに対して、カバレッジを取れるようにするという、品質視点での機能があるのも特徴です。
さらにSQLの開発生産性を格段に上げるREPL機能も搭載しています。
[](https://asciinema.org/a/122312)
## Installation
### for Maven
```xml
jp.co.future
uroborosql
1.0.5
org.springframework
spring-expression
5.3.20
```
または
```xml
jp.co.future
uroborosql
1.0.5
ognl
ognl
3.1.23
```
### for Gradle
```gradle
compile group: 'jp.co.future', name: 'uroborosql', version: '1.0.5'
compile group: 'org.springframework', name: 'spring-expression', version: '5.3.20'
```
または
```gradle
compile group: 'jp.co.future', name: 'uroborosql', version: '1.0.5'
compile group: 'ognl', name: 'ognl', version: '3.1.23'
```
## Documentation
[https://future-architect.github.io/uroborosql-doc/](https://future-architect.github.io/uroborosql-doc/)
## Requirement
- Java 11 or later.
## Quick start
### 2Way-SQL
```sql
/* department/select_department.sql */
SELECT /* _SQL_ID_ */
DEPT.DEPT_NO AS DEPT_NO
, DEPT.DEPT_NAME AS DEPT_NAME
FROM
DEPARTMENT DEPT
WHERE
1 = 1
/*IF SF.isNotEmpty(dept_no)*/
AND DEPT.DEPT_NO = /*dept_no*/1
/*END*/
/*IF SF.isNotEmpty(dept_name)*/
AND DEPT.DEPT_NAME = /*dept_name*/'sample'
/*END*/
```
```sql
/* department/insert_department.sql */
INSERT
/* _SQL_ID_ */
INTO
DEPARTMENT
(
DEPT_NO
, DEPT_NAME
) VALUES (
/*dept_no*/1
, /*dept_name*/'sample'
)
```
```java
SqlConfig config = UroboroSQL.builder("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1", "sa", "")
.build();
try (SqlAgent agent = config.agent()) {
// SELECT
List> departments = agent.query("department/select_department")
.param("dept_no", 1001)
.collect();
// INSERT
int count = agent.update("department/insert_department")
.param("dept_no", 1001)
.param("dept_name", "sales")
.count();
}
```
### DAO Interface
```java
SqlConfig config = UroboroSQL.builder("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1", "sa", "")
.build();
try (SqlAgent agent = config.agent()) {
// select
Department dept = agent.find(Department.class, 1001)
.orElse(null);
// insert
Department hrDept = new Department();
hrDept.setDeptNo(1002);
hrDept.setDeptName("HR");
agent.insert(hrDept);
// update
hrDept.setDeptName("Human Resources");
agent.update(hrDept);
// delete
agent.delete(hrDept);
}
```
## Sample application
- CLI
-
- Web application(with Spring Boot)
-
## Automated code generation
- uroboroSQL source generator
-
## SQL Formatter

開発で便利なSQL formatterも用意しています。
- CLI
-
- VSCode Plugin
-
- Eclipse Plugin
-
- Sublime Text 3 Plugin
-
- IntelliJ IDEA Platform Plugin
-
## License
Released under the [MIT License](https://github.com/future-architect/uroborosql/blob/master/LICENSE).