- Notifications
You must be signed in to change notification settings - Fork0
Programing like SQL syntax with Java
License
icuter/jsql
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Welcome to JSQL. It's a lightweight JDBC DSL framework, JSQL meansJust SQL
and without ORM configuration.It is a framework which is convenience and easy to use, just like sql syntax that you feel free to write SQL as usual andmakes Java SQL development more easier.
If you are a Java developer searching for the jdbc framework satisfy functions as connection pool, super lightweight ormand want to write sql like java code programing, then I suggest you could try to use JSQL framework for jdbc operation.
JSQL for Reasons:
- No SQL string and keep your code graceful
- No ORM bean code generation mass your git control
- Provide ExecutorPool/ConnectionPool for jdbc connection pooling without DBCP dependencies
- JDK6 or higher
- Connection/JdbcExecutor pool
- SQL syntax like builder
- Transaction
- Support customizing dialects
- Pagination
- Jdbc executor for query, update or batch update
- Super lightweight ORM
- Against SQL inject
- Logging ability
- Cubrid
- SQLite
- DB2
- Derby (EmbeddedDerby/NetworkDerby)
- H2
- MariaDB
- MySQL
- Oracle
- PostgreSQL
- SQLServer2012(version >= 2012)
<!-- for jdk1.8+--><dependency> <groupId>cn.icuter</groupId> <artifactId>jsql</artifactId> <version>1.1.2</version></dependency><!-- for jdk1.6+--><dependency> <groupId>cn.icuter</groupId> <artifactId>jsql-jdk1.6</artifactId> <version>1.1.2</version></dependency>
JSQLDataSourcedataSource =JSQLDataSource.newDataSourceBuilder() .url("jdbcUrl").user("jsql").password("pass").build();List<Map<String,Object>>list =dataSource.select() .from("table") .where().eq("name","jsql") .execQuery();
SQL: select * from table where name = ?Value: [jsql]
JSQLDataSourcedataSource =JSQLDataSource.newDataSourceBuilder() .url("jdbcUrl").user("jsql").password("pass").build();dataSource.transaction(tx -> {tx.insert("table") .values(Cond.eq("col1","val1"),Cond.eq("col2",102),Cond.eq("col3","val3")) .execUpdate();// if exception thrown will call tx.rollback()// tx.commit(); // auto commit if transaction ended});
SQL: insert into table(col1,col2,col3) values(?,?,?)VALUE: ["val1", 102, "val3"]
Using standalone Transaction to control commit or rollback operation as your favour
JSQLDataSourcedataSource =JSQLDataSource.newDataSourceBuilder() .url("jdbcUrl").user("jsql").password("pass").build();TransactionDataSourcetx =dataSource.transaction();tx.insert("table") .values(Cond.eq("col1","val1"),Cond.eq("col2",102),Cond.eq("col3","val3")) .execUpdate();tx.close();// auto commit
SQL: insert into table(col1,col2,col3) values(?,?,?)VALUE: ["val1", 102, "val3"]
NOTE
Above examples are using JSQLDataSource inner Connection pool to execute SQL generated by JSQL.
Find more documentationhere.
- DataSource
- JDBC Connection Pool
- Transaction
- SQL Builder
- Condition
- DB Dialect
- ORM
- SQL Executor
- Logging Customization
performance
- remove Injection's read lock and add snapshot root node for improvement
features
- use builder patterns to create
JSQLDatasource
more easier
others
- update checkstyle version
- simplify Test Unit Exception checking with Lamda
bug fixes
- fix ReentrantLock.lock() prior to try-finally block
- fix bugs which have been detected by FindBugs tools
performance
- optimize scheduled task checking and invalidation
bug fixes
- fix fields injection
performance
- optimize injection checking
- avoid inflating schedule tasks
bug fixes
- fix idle object schedule thread can't shutdown immediately
features
- support validating field name and table name injection
bug fixes
- fix NPE while checking idle object
bug fixes
- fix top-select in
SelectBuilder.select
features
- support transaction in JSQLDataSource
- support
insert... select...
syntax - support Driver properties when getting Connection from Driver
bug fixes
- fix pool configuration
features
- execute builder directly in JSQLDataSource
- refactor Connection object idle timeout validation
jsql-jdk1.6 missing this version
breaks
- Remove
Builder.union
andBuilder.unionAll
operation
bug fixes
- fix
OracleDialect
invalid table alias name format - fix
DB2Dialect
invalid table alias name format
features
- Add builder as Condition value
- Add
UnionSelectBuilder
for union/unionAll operation
jsql-jdk1.6 missing this version
About
Programing like SQL syntax with Java
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.