From d13eb9ecffc0aa92692783afe0e94b86e95f6a7f Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 5 Nov 2024 16:13:52 +0100 Subject: [PATCH 1/5] Update for next development version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4c44712..d348f72 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ ch.martinelli.oss jooq-spring - 0.3.0 + 0.3.1-SNAPSHOT jOOQ Spring Integration Helpful utilities when using jOOQ with Spring From 7b6c1aa683f62cc063278c8677d291f7c74635d8 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 5 Nov 2024 16:26:36 +0100 Subject: [PATCH 2/5] Updated release version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dffb8f5..55c0b02 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Add a dependency to the current version: ch.martinelli.oss jooq-spring - 0.2.0 + 0.3.0 ``` From a83ec94aaa7639234922edf14e60d21340ebc622 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 5 Nov 2024 18:35:35 +0100 Subject: [PATCH 3/5] #12: Implement saveAll --- .../java/ch/martinelli/oss/jooqspring/JooqDAO.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/ch/martinelli/oss/jooqspring/JooqDAO.java b/src/main/java/ch/martinelli/oss/jooqspring/JooqDAO.java index a35bed8..2fef62f 100644 --- a/src/main/java/ch/martinelli/oss/jooqspring/JooqDAO.java +++ b/src/main/java/ch/martinelli/oss/jooqspring/JooqDAO.java @@ -155,6 +155,17 @@ public int save(R record) { return record.store(); } + /** + * Saves a list of records to the database using batch store operations. + * + * @param records the list of records to be saved + * @return an array containing the number of affected rows for each batch operation + */ + @Transactional + public int[] saveAll(List records) { + return dslContext.batchStore(records).execute(); + } + /** * Merges (INSERT … ON DUPLICATE KEY UPDATE) the given record into the database. Attaches the record to the DSLContext * and attempts to merge it. From b6c5659cd92bcde3282b37ee12db95f47d812967 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 5 Nov 2024 18:40:10 +0100 Subject: [PATCH 4/5] #12: Add saveAll to list of methods. Fixes typo --- README.md | 30 +++++++++++++++--------------- pom.xml | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 55c0b02..6102dc9 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,19 @@ The JooqDAO follows the [DAO pattern](https://en.wikipedia.org/wiki/Data_access_ the [Repository pattern](https://martinfowler.com/eaaCatalog/repository.html) because the Repository is a pattern from Domain Driven Design (DDD). +#### Usage + +```java + +@Component +public class AthleteDAO extends JooqDAO { + + public AthleteDAO(DSLContext dslContext) { + super(dslContext, ATHLETE); + } +} +``` + #### Methods | Return Type | Method | Description | @@ -36,26 +49,13 @@ Domain Driven Design (DDD). | `int` | `count()` | Counts the total number of records in the associated table. | | `int` | `count(org.jooq.Condition condition)` | Counts the number of records in the associated table that match the given condition. | | `int` | `save(R record)` | Saves the given record to the database. | +| `int[]` | `saveAll(List record)` | Saves a list of records to the database using batch store operations. | | `int` | `merge(R record)` | Merges the given record into the database. | | `int` | `deleteById(ID id)` | Deletes a record from the database identified by its primary key. | | `int` | `delete(R record)` | Deletes the specified record from the database. | | `int` | `delete(org.jooq.Condition condition)` | Deletes records from the database that match the given condition. | -Checkout the code for documentation for further -information [JooqDAO](src/main/java/ch/martinelli/oss/jooqspring/JooqDAO.java). - -#### Usage - -```java - -@Component -public class AthleteDAO extends JooqDAO { - - public AthleteDAO(DSLContext dslContext) { - super(dslContext, ATHLETE); - } -} -``` +Check out the code documentation for further information [JooqDAO](src/main/java/ch/martinelli/oss/jooqspring/JooqDAO.java). ## License diff --git a/pom.xml b/pom.xml index d348f72..b1a6b6d 100644 --- a/pom.xml +++ b/pom.xml @@ -132,7 +132,7 @@ scm:git:git@github.com:martinellich/jooq-spring.git scm:git:git@github.com:martinellich/jooq-spring.git - git@github.com:maritnellich/jooq-spring.git + git@github.com:martinellich/jooq-spring.git From 0ecd6efc96e98362d15a158c6f6ed50675933c00 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 5 Nov 2024 18:42:57 +0100 Subject: [PATCH 5/5] Update versions for release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b1a6b6d..3324542 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ ch.martinelli.oss jooq-spring - 0.3.1-SNAPSHOT + 0.4.0 jOOQ Spring Integration Helpful utilities when using jOOQ with Spring