net.turnbig:spring-data-jdbcx

spring data JDBC extension

License

License

Categories

Categories

Data Net
GroupId

GroupId

net.turnbig
ArtifactId

ArtifactId

spring-data-jdbcx
Last Version

Last Version

2.0.6
Release Date

Release Date

Type

Type

jar
Description

Description

net.turnbig:spring-data-jdbcx
spring data JDBC extension
Project URL

Project URL

https://github.com/IamFive/spring-data-jdbcx
Source Code Management

Source Code Management

https://github.com/IamFive/spring-data-jdbcx

Download spring-data-jdbcx

How to add to project

<!-- https://jarcasting.com/artifacts/net.turnbig/spring-data-jdbcx/ -->
<dependency>
    <groupId>net.turnbig</groupId>
    <artifactId>spring-data-jdbcx</artifactId>
    <version>2.0.6</version>
</dependency>
// https://jarcasting.com/artifacts/net.turnbig/spring-data-jdbcx/
implementation 'net.turnbig:spring-data-jdbcx:2.0.6'
// https://jarcasting.com/artifacts/net.turnbig/spring-data-jdbcx/
implementation ("net.turnbig:spring-data-jdbcx:2.0.6")
'net.turnbig:spring-data-jdbcx:jar:2.0.6'
<dependency org="net.turnbig" name="spring-data-jdbcx" rev="2.0.6">
  <artifact name="spring-data-jdbcx" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.turnbig', module='spring-data-jdbcx', version='2.0.6')
)
libraryDependencies += "net.turnbig" % "spring-data-jdbcx" % "2.0.6"
[net.turnbig/spring-data-jdbcx "2.0.6"]

Dependencies

compile (18)

Group / Artifact Type Version
org.springframework : spring-jdbc jar
org.springframework.data : spring-data-commons jar
org.springframework : spring-context jar
javax.persistence : persistence-api jar 1.0.2
com.github.jsqlparser : jsqlparser jar 0.9.4
net.turnbig : query-builder Optional jar 2.0.0
org.freemarker : freemarker jar
commons-io : commons-io jar 2.4
org.apache.commons : commons-lang3 jar 3.3.2
org.apache.commons : commons-collections4 jar 4.0
com.google.guava : guava jar 21.0-rc2
org.postgresql : postgresql Optional jar
com.fasterxml.jackson.core : jackson-databind Optional jar
org.slf4j : slf4j-api jar
ch.qos.logback : logback-classic jar
org.bgee.log4jdbc-log4j2 : log4jdbc-log4j2-jdbc4.1 Optional jar 1.16
javax.servlet : javax.servlet-api Optional jar
org.springframework.boot : spring-boot jar

test (5)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-jdbc jar
org.springframework.boot : spring-boot-starter-test jar
org.assertj : assertj-core jar
org.flywaydb : flyway-core jar
com.h2database : h2 jar

Project Modules

There are no modules declared in this project.

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...

Versions

Version
2.0.6
2.0.5
2.0.4
2.0.3
2.0.2
2.0.1
2.0.0