Sorm4j
https://gyazo.com/faf8f4007150f7e98141af6d14bd093a
Overview
https://gyazo.com/821728c9ea8eb75e3139448ddd81cc13
Sorm4j (Simple micro Object-Relation Mapper for Java) is a Java-based micro-ORM tool that could access a database in a oneliner. Sorm4j is a sort of JDBC wrapper. It provides simple functionalities to do select, insert, update, delete, merge and join.
License
Sorm4j is distributed under a Apache License Version 2.0.
Repository
yuu-nkjm/sorm4j: A Simple micro ORM framework for Java
Private and experimental API
The classes in org.nkjmlab.sorm4j.internal are regarded as private API. Experimental elements are annotated by @Experimental.
Web page
Quickstart
To get started, see here.
Quickstart
Next to get started, see here.
Examples
If you need more example codes, please take a look at the Examples page and the [Example of Sorm4j (https://github.com/yuu-nkjm/sorm4j-example] repository.
Core
The key features of Sorm4j, see here.
Performance
If you need more benchmark results, please take a look at the Performance page and the Benchmark of Sorm4j repository.
Developer's Guide
The detailed manual is here.
Javadoc
sorm4j latest javadoc
/yuunkjm/--.icon
Features
/yuunkjm/--.icon
Sorm4j is designed to be:
Simple
Sorm4j provides a simple way to access a JDBC database, usually in one line of code.
Sorm4j could be treated with simple POJO and Record class.
You could write your own SQL statements. > Customization
Performance: Sorm4j's overhead comparing to plain JDBC operations is low > Performance
Small footprint: The file size of sorm4j-1.4.6.jar is about 250KB.
/yuunkjm/--.icon
Sorm4j supports :
Insert JavaObject directly
Sorm4j supports multi-row insert. Multi-row insert is faster than batch insert if you use H2 database.
code:java
sorm.insert(new Customer(1, "Alice", "Tokyo"));
sorm.insert(new Customer(2, "Bob", "Tokyo"), new Customer(3, "Carol", "Osaka"), new Customer(4, "Dave", "Nara"));
Retrieving assigned auto-generated values > Customization
Simple transaction support
Sorm4j could create a transaction as lambda expression. > Customization
code:java
sorm.acceptHandler(Connection.TRANSACTION_READ_COMMITTED, conn -> {
conn.insert(Customer.ALICE);
// After the process of handler, the transaction is rollback automatically.
});
External connection pooling library: Sorm4j can be combined with other connection pooling library (e.g. HikariCP).
Annotations for customizazion >Customization
Simple join support: Sorm4j could read a joined result >Customization
/yuunkjm/--.icon
Sorm4j is not:
not tested various RDBMS product
Sorm4j is only tested with H2. Most of functions of Sorm4j runnuble various RDBMS producs becase it uses standard SQL expressions . Som tests are executed by H2 compatibility Mode of MySQL, PostgreSQL, MS SQL Server and Oracle.
/yuunkjm/--.icon
Supported databases (Tested database)
Sorm4j is usable with the database which provids JDBC driver.
Tested databases (with high coverage test)
H2 (2.1.210)
Tested databases (with test of basic object-relation mapping) @ v 1.3.19
MySQL (8.0.23) with JDBC driver 8.0.23 PostgreSQL (12.5-RC) with JDBC driver 42.2.19
Microsoft SQL Server (SQL Server Express Edition: SQL Server 2019 15.00.4073.23.v1) with JDBC driver 9.2.1.jre11
Oracle (19c SE2) with JDBC driver 19.10.0.0
/yuunkjm/--.icon
Other similar libraries
r5v9/persist: Persist is a Java ORM/DAO library designed for high performance, ease of use and integration.
jdbi/jdbi: jdbi is designed to provide convenient tabular data access in Java; including templated SQL, parameterized and strongly typed queries, and Streams integration
aaberg/sql2o: sql2o is a small library, which makes it easy to convert the result of your sql-statements into objects. No resultset hacking required. Kind of like an orm, but without the sql-generation capabilities. Supports named parameters.
EvidentSolutions/dalesbred: Dalesbred - a database access library for Java
dieselpoint/norm: Access a database in one line of code.
knowm/Yank: Ultra-Light JDBC Persistance Layer
gitblit/iciql: a model-based, database access wrapper for JDBC
biezhi/anima: Minimal database operation library.