IamFive / spring-data-jdbcx

spring data jdbc extentions - more friendly api and JPA-style pagination support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

spring-data-jdbcx

Spring-data-jdbcx is an extention for spring-jdbc-template. Spring-data-jdbcx makes it easy to connect with databases.

how to use

You can download from maven central, add dependency to your pom.xml

	<dependency>
		<groupId>net.turnbig</groupId>
		<artifactId>spring-data-jdbcx</artifactId>
		<version>2.0.6</version>
	</dependency>

For more example, please check the unit tests.

To integrate with spring boot, add net.turnbig.jdbcx to auto scan package. And if you want to use the sql template feature, add configurations below:

# SQL template loading path
spring.jdbcx.sql.template-path = classpath:/sql-template
# SQL template encoding
spring.jdbcx.sql.template-encoding = UTF-8
# SQL auto refresh delay
spring.jdbcx.sql.update-delay = 0

Planed Features

abstract more friendly jdbc-template-API

  • use Bean/Map as named-query parameter
  • return Bean/Map for query directly
  • pageable(order by included) support

hiding lesser-used jdbc-template-API

  • you can still use the API by get original template

sql template support

  • use freemarker as template engineer - (dynamic sql benifed from freemarker)
  • use seperated xml to define sql templates

customer converter

  • you can inject a customer converter service for the type not support by default
  • PGobject to Map/List/Bean converter

why spring-data-jdbcx

For database tools, I think the most important parts are:

  • full control of SQL (what sql will run, query/update/insert/delete/batch/etc)
  • dynamic & clear & structed SQL seperated from code (SQL loaded from xml or somewhere, Mybatis do pretty good in this part)
  • simply result-set mapping to JavaBean/Map/Integer/String/etc
  • Pagination & dynamic Order inject support

There got many database tools, Hibernate, Mybatis, Jooq etc. Of course they are good, but spring-data-jdbcx will be more Smart. With spring-data-jdbcx, you will benifit from all spring-jdbc-template's adventage(low level api), you will got high level mapping too. You could pass JavaBean/Map as parameter, you could simply get Bean/map/primitive-type as result. It got pagination featurn which almost support all kind of select-sql and database. to be continue...

About

spring data jdbc extentions - more friendly api and JPA-style pagination support

License:Apache License 2.0


Languages

Language:Java 99.4%Language:TSQL 0.6%