From b0b8509b1df6f447bd86a849dfad6b6fb6fe68e0 Mon Sep 17 00:00:00 2001 From: Marco Date: Wed, 24 Feb 2016 16:45:13 +0100 Subject: [PATCH 1/6] Create README.md --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..8fff6d7 --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +# springBootBatch + +Spring Boot – Batch tutorial using MySQL, JPA and annotations + +In this example I show how to use Spring Boot to create a simple Spring Batch application. +I used the same architecture in a production software. Spring Boot is great to improve productivity but the documentation is still sparse (the framework is still in 0.5 version). + +You can find more details here: +http://javaee.ch/2013/10/27/spring-boot-batch-tutorial-using-mysql-jpa-and-annotations/ +The only requirement is to have a mysql database installed. +You can find more information in the source code. + +If you start a new project in an IDE, you can simply create a simple new maven project (without Spring wizards or similar). + From 89c00af69616790b3fcd9622e9fee15f207d5336 Mon Sep 17 00:00:00 2001 From: marco Date: Sat, 21 Oct 2017 12:32:15 +0200 Subject: [PATCH 2/6] version update --- pom.xml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 40e5f52..5429a19 100644 --- a/pom.xml +++ b/pom.xml @@ -6,11 +6,11 @@ springBootBatch springBootBatch - 0.1-SNAPSHOT + 0.2-SNAPSHOT org.springframework.boot spring-boot-starter-parent - 0.5.0.M5 + 1.5.8.RELEASE @@ -26,14 +26,12 @@ mysql-connector-java 5.1.26 - org.springframework.boot spring-boot-maven-plugin - From 0272fed0a8f81dbdc57608b90335159d60c992b4 Mon Sep 17 00:00:00 2001 From: marco Date: Sat, 21 Oct 2017 13:00:30 +0200 Subject: [PATCH 3/6] version update --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5429a19..cb6fecd 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ mysql mysql-connector-java - 5.1.26 + 5.1.39 From b0acccc9557217148ea3ea49e879f77c51d1e0b2 Mon Sep 17 00:00:00 2001 From: marco Date: Thu, 1 Apr 2021 13:00:02 +0200 Subject: [PATCH 4/6] update to spring boot and mysql 8 --- pom.xml | 34 ++++++++----------- .../javaee/springBootBatch/Application.java | 2 ++ .../springBootBatch/BatchConfiguration.java | 2 +- src/main/resources/application.properties | 12 +++++-- 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/pom.xml b/pom.xml index cb6fecd..16f2588 100644 --- a/pom.xml +++ b/pom.xml @@ -6,11 +6,11 @@ springBootBatch springBootBatch - 0.2-SNAPSHOT + 0.3-SNAPSHOT org.springframework.boot spring-boot-starter-parent - 1.5.8.RELEASE + 2.4.3 @@ -24,7 +24,18 @@ mysql mysql-connector-java - 5.1.39 + [8.0.22,) + + + + javax.xml.bind + jaxb-api + 2.3.1 + + + org.glassfish.jaxb + jaxb-runtime + 2.3.3 @@ -35,19 +46,4 @@ - - - spring-snapshots - http://repo.spring.io/libs-snapshot - true - - - - - - spring-snapshots - http://repo.spring.io/libs-snapshot - true - - - \ No newline at end of file + diff --git a/src/main/java/ch/javaee/springBootBatch/Application.java b/src/main/java/ch/javaee/springBootBatch/Application.java index 4907e0b..cf9fa3f 100644 --- a/src/main/java/ch/javaee/springBootBatch/Application.java +++ b/src/main/java/ch/javaee/springBootBatch/Application.java @@ -1,7 +1,9 @@ package ch.javaee.springBootBatch; import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +@SpringBootApplication public class Application { public static void main(String args[]) { SpringApplication.run(BatchConfiguration.class, args); diff --git a/src/main/java/ch/javaee/springBootBatch/BatchConfiguration.java b/src/main/java/ch/javaee/springBootBatch/BatchConfiguration.java index dca4b47..5ee6826 100644 --- a/src/main/java/ch/javaee/springBootBatch/BatchConfiguration.java +++ b/src/main/java/ch/javaee/springBootBatch/BatchConfiguration.java @@ -179,7 +179,7 @@ public JpaVendorAdapter jpaVendorAdapter() { jpaVendorAdapter.setGenerateDdl(true); jpaVendorAdapter.setShowSql(false); - jpaVendorAdapter.setDatabasePlatform("org.hibernate.dialect.MySQLDialect"); + jpaVendorAdapter.setDatabasePlatform("org.hibernate.dialect.MySQL8Dialect"); return jpaVendorAdapter; } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 267db44..b23ad5c 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -2,7 +2,15 @@ spring.jpa.hibernate.ddl-auto=create # no sql in the log spring.jpa.show-sql=false -database.driver=com.mysql.jdbc.Driver + +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect + +# updated to create the initial schema +spring.batch.initialize-schema=ALWAYS + +# schema for mysql >= 8 +database.driver=com.mysql.cj.jdbc.Driver + database.url=jdbc:mysql://localhost:3306/BatchDB database.username=root -database.password= \ No newline at end of file +database.password= From 63e9aa5b63753b83692aa557b871ac16a2f8b6f9 Mon Sep 17 00:00:00 2001 From: Marco Date: Thu, 1 Apr 2021 13:03:12 +0200 Subject: [PATCH 5/6] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 8fff6d7..1354ac5 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,9 @@ Spring Boot – Batch tutorial using MySQL, JPA and annotations In this example I show how to use Spring Boot to create a simple Spring Batch application. -I used the same architecture in a production software. Spring Boot is great to improve productivity but the documentation is still sparse (the framework is still in 0.5 version). You can find more details here: -http://javaee.ch/2013/10/27/spring-boot-batch-tutorial-using-mysql-jpa-and-annotations/ +https://marco.dev/spring-boot-batch-tutorial-using-mysql-jpa-and-annotations The only requirement is to have a mysql database installed. You can find more information in the source code. From ac55b2604fca36dcf64e16296d73e7d7b47e482e Mon Sep 17 00:00:00 2001 From: marco Date: Thu, 1 Apr 2021 13:09:56 +0200 Subject: [PATCH 6/6] changed db schema --- src/main/resources/application.properties | 2 +- src/main/resources/import.sql | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index b23ad5c..e57b73c 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -11,6 +11,6 @@ spring.batch.initialize-schema=ALWAYS # schema for mysql >= 8 database.driver=com.mysql.cj.jdbc.Driver -database.url=jdbc:mysql://localhost:3306/BatchDB +database.url=jdbc:mysql://localhost:3306/batch_db_example database.username=root database.password= diff --git a/src/main/resources/import.sql b/src/main/resources/import.sql index 0bd3b66..a99fb90 100644 --- a/src/main/resources/import.sql +++ b/src/main/resources/import.sql @@ -1,11 +1,11 @@ -drop table BatchDB.Batch_JOB_EXECUTION_CONTEXT; -drop table BatchDB.Batch_JOB_EXECUTION_PARAMS; -drop table BatchDB.Batch_JOB_EXECUTION_SEQ; -drop table BatchDB.Batch_JOB_SEQ; -drop table BatchDB.Batch_STEP_EXECUTION_CONTEXT; -drop table BatchDB.Batch_STEP_EXECUTION_SEQ; -drop table BatchDB.Batch_STEP_EXECUTION; -drop table BatchDB.Batch_JOB_EXECUTION; -drop table BatchDB.Batch_JOB_INSTANCE; +drop table batch_db_example.Batch_JOB_EXECUTION_CONTEXT; +drop table batch_db_example.Batch_JOB_EXECUTION_PARAMS; +drop table batch_db_example.Batch_JOB_EXECUTION_SEQ; +drop table batch_db_example.Batch_JOB_SEQ; +drop table batch_db_example.Batch_STEP_EXECUTION_CONTEXT; +drop table batch_db_example.Batch_STEP_EXECUTION_SEQ; +drop table batch_db_example.Batch_STEP_EXECUTION; +drop table batch_db_example.Batch_JOB_EXECUTION; +drop table batch_db_example.Batch_JOB_INSTANCE;