Skip to content

Commit 9179f4e

Browse files
committed
Remove batch support to simplify code
1 parent 09926f1 commit 9179f4e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+434
-1126
lines changed

pom.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,10 @@
155155
<sqlite.version>3.45.1.0</sqlite.version>
156156
<teradata.version>13.10.00.35</teradata.version>
157157
<firebird.version>5.0.3.java11</firebird.version>
158-
<reactor-core.version>3.3.5.RELEASE</reactor-core.version>
159158
<mongodb.version>3.12.14</mongodb.version>
160159

160+
<r2dbc.version>1.0.0.RELEASE</r2dbc.version>
161+
161162
<!-- JPA deps -->
162163
<hibernate.version>6.4.4.Final</hibernate.version>
163164
<hibernate.validator.version>8.0.1.Final</hibernate.validator.version>
@@ -297,6 +298,13 @@
297298
<type>pom</type>
298299
<scope>import</scope>
299300
</dependency>
301+
<dependency>
302+
<groupId>io.projectreactor</groupId>
303+
<artifactId>reactor-bom</artifactId>
304+
<version>2023.0.3</version>
305+
<type>pom</type>
306+
<scope>import</scope>
307+
</dependency>
300308
</dependencies>
301309
</dependencyManagement>
302310

querydsl-core/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
<dependency>
3232
<groupId>io.projectreactor</groupId>
3333
<artifactId>reactor-core</artifactId>
34-
<version>${reactor-core.version}</version>
3534
</dependency>
3635

3736
<!-- alias dependencies -->

querydsl-examples/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
<module>querydsl-example-kotlin-codegen</module>
2424
<module>querydsl-example-kotlin-jpa</module>
2525
<module>querydsl-example-kotlin-mongodb</module>
26+
27+
<module>querydsl-example-r2dbc-sql-codegen</module>
2628
</modules>
2729

2830
<dependencyManagement>

querydsl-examples/querydsl-example-r2dbc-sql-codegen/pom.xml

Lines changed: 23 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,44 @@
55
<parent>
66
<groupId>io.github.openfeign.querydsl</groupId>
77
<artifactId>querydsl-examples</artifactId>
8-
<version>5.0.0-SNAPSHOT</version>
9-
<relativePath>../</relativePath>
8+
<version>6.1-SNAPSHOT</version>
109
</parent>
1110

12-
<groupId>io.github.openfeign.querydsl</groupId>
1311
<artifactId>querydsl-example-r2dbc-sql-codegen</artifactId>
14-
<packaging>jar</packaging>
1512
<name>Querydsl example - R2DBC SQL Codegen</name>
1613

1714
<properties>
18-
<java.version>1.8</java.version>
1915
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
20-
<spring.version>5.2.2.RELEASE</spring.version>
21-
<spring-data-r2dbc.version>1.0.0.RELEASE</spring-data-r2dbc.version>
22-
<reactor.version>3.3.5.RELEASE</reactor.version>
23-
<r2dbc-h2.version>0.8.1.RELEASE</r2dbc-h2.version>
24-
<h2.version>1.4.200</h2.version>
16+
<spring.version>6.1.4</spring.version>
17+
18+
<!-- to match spring JDK version -->
19+
<main.java.version>17</main.java.version>
2520
</properties>
2621

2722
<dependencies>
2823

2924
<!-- spring -->
3025

3126
<dependency>
32-
<groupId>org.springframework.data</groupId>
33-
<artifactId>spring-data-r2dbc</artifactId>
34-
<version>${spring-data-r2dbc.version}</version>
27+
<groupId>org.springframework</groupId>
28+
<artifactId>spring-context</artifactId>
29+
<version>${spring.version}</version>
3530
</dependency>
3631
<dependency>
3732
<groupId>org.springframework</groupId>
38-
<artifactId>spring-context</artifactId>
33+
<artifactId>spring-aop</artifactId>
3934
<version>${spring.version}</version>
4035
</dependency>
36+
<dependency>
37+
<groupId>org.springframework.data</groupId>
38+
<artifactId>spring-data-r2dbc</artifactId>
39+
<version>3.2.3</version>
40+
</dependency>
4141

4242
<dependency>
4343
<groupId>org.projectlombok</groupId>
4444
<artifactId>lombok</artifactId>
45-
<version>1.18.12</version>
45+
<version>1.18.30</version>
4646
<scope>provided</scope>
4747
</dependency>
4848

@@ -55,12 +55,12 @@
5555
<dependency>
5656
<groupId>io.r2dbc</groupId>
5757
<artifactId>r2dbc-h2</artifactId>
58-
<version>${r2dbc-h2.version}</version>
58+
<version>${r2dbc.version}</version>
5959
</dependency>
6060
<dependency>
6161
<groupId>com.h2database</groupId>
6262
<artifactId>h2</artifactId>
63-
<version>${h2.version}</version>
63+
<scope>test</scope>
6464
</dependency>
6565
<dependency>
6666
<groupId>com.jolbox</groupId>
@@ -69,24 +69,11 @@
6969
<classifier>jdk7</classifier>
7070
</dependency>
7171

72-
<!-- logging -->
73-
<dependency>
74-
<groupId>org.slf4j</groupId>
75-
<artifactId>slf4j-api</artifactId>
76-
<version>1.6.1</version>
77-
</dependency>
78-
<dependency>
79-
<groupId>org.slf4j</groupId>
80-
<artifactId>slf4j-log4j12</artifactId>
81-
<version>1.6.1</version>
82-
</dependency>
72+
<!-- TEST dependencies -->
8373
<dependency>
84-
<groupId>log4j</groupId>
85-
<artifactId>log4j</artifactId>
86-
<version>1.2.17</version>
74+
<groupId>org.junit.vintage</groupId>
75+
<artifactId>junit-vintage-engine</artifactId>
8776
</dependency>
88-
89-
<!-- TEST dependencies -->
9077
<dependency>
9178
<groupId>org.springframework</groupId>
9279
<artifactId>spring-test</artifactId>
@@ -96,36 +83,13 @@
9683
<dependency>
9784
<groupId>io.projectreactor</groupId>
9885
<artifactId>reactor-test</artifactId>
99-
<version>${reactor.version}</version>
10086
<scope>test</scope>
10187
</dependency>
10288
</dependencies>
10389

104-
<pluginRepositories>
105-
<pluginRepository>
106-
<releases>
107-
<enabled>true</enabled>
108-
</releases>
109-
<snapshots>
110-
<enabled>true</enabled>
111-
</snapshots>
112-
<id>sonatype-oss-public</id>
113-
<url>https://oss.sonatype.org/content/groups/public</url>
114-
</pluginRepository>
115-
</pluginRepositories>
116-
11790
<build>
11891
<finalName>querydsl-example-r2dbc-spring</finalName>
11992
<plugins>
120-
<plugin>
121-
<groupId>org.apache.maven.plugins</groupId>
122-
<artifactId>maven-compiler-plugin</artifactId>
123-
<configuration>
124-
<source>1.8</source>
125-
<target>1.8</target>
126-
</configuration>
127-
</plugin>
128-
12993
<plugin>
13094
<groupId>io.github.openfeign.querydsl</groupId>
13195
<artifactId>querydsl-maven-plugin</artifactId>
@@ -135,8 +99,8 @@
13599
<jdbcUrl>jdbc:h2:mem:testdb;INIT=runscript from 'file:${project.baseUri}/src/main/sql/001_schema.sql'</jdbcUrl>
136100
<jdbcUser>sa</jdbcUser>
137101
<customTypes>
138-
<customType>com.querydsl.r2dbc.types.JSR310LocalDateTimeType</customType>
139-
<customType>com.querydsl.r2dbc.types.JSR310LocalDateType</customType>
102+
<customType>com.querydsl.sql.types.LocalDateTimeType</customType>
103+
<customType>com.querydsl.sql.types.LocalDateType</customType>
140104
</customTypes>
141105
<packageName>com.querydsl.example.r2dbc</packageName>
142106
<targetFolder>${project.basedir}/target/generated-sources/java</targetFolder>
@@ -151,7 +115,7 @@
151115
<executions>
152116
<execution>
153117
<goals>
154-
<goal>r2dbc-export</goal>
118+
<goal>export</goal>
155119
</goals>
156120
</execution>
157121
</executions>

querydsl-examples/querydsl-example-r2dbc-sql-codegen/src/main/java/com/querydsl/example/config/AppConfiguration.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
package com.querydsl.example.config;
22

3-
import com.querydsl.example.dao.*;
3+
import com.querydsl.example.dao.CustomerDao;
4+
import com.querydsl.example.dao.CustomerDaoImpl;
5+
import com.querydsl.example.dao.OrderDao;
6+
import com.querydsl.example.dao.OrderDaoImpl;
7+
import com.querydsl.example.dao.PersonDao;
8+
import com.querydsl.example.dao.PersonDaoImpl;
9+
import com.querydsl.example.dao.ProductDao;
10+
import com.querydsl.example.dao.ProductDaoImpl;
11+
import com.querydsl.example.dao.SupplierDao;
12+
import com.querydsl.example.dao.SupplierDaoImpl;
413
import com.querydsl.r2dbc.R2DBCConnectionProvider;
514
import com.querydsl.r2dbc.R2DBCQueryFactory;
615
import com.querydsl.r2dbc.SQLTemplates;
716
import io.r2dbc.spi.ConnectionFactory;
8-
import javax.inject.Inject;
17+
import org.springframework.beans.factory.annotation.Autowired;
918
import org.springframework.context.annotation.Bean;
1019
import org.springframework.context.annotation.Configuration;
1120
import org.springframework.context.annotation.Import;
1221
import org.springframework.core.env.Environment;
13-
import org.springframework.data.r2dbc.connectionfactory.R2dbcTransactionManager;
22+
import org.springframework.r2dbc.connection.R2dbcTransactionManager;
1423
import org.springframework.transaction.annotation.EnableTransactionManagement;
1524
import reactor.core.publisher.Mono;
1625

@@ -19,7 +28,7 @@
1928
@Import(R2DBCConfiguration.class)
2029
public class AppConfiguration {
2130

22-
@Inject Environment env;
31+
@Autowired Environment env;
2332

2433
@Bean
2534
CustomerDao customerDao() {

querydsl-examples/querydsl-example-r2dbc-sql-codegen/src/main/java/com/querydsl/example/dao/CustomerDaoImpl.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
import com.querydsl.r2dbc.R2DBCQueryFactory;
1717
import com.querydsl.r2dbc.dml.R2DBCInsertClause;
1818
import com.querydsl.r2dbc.group.ReactiveGroupBy;
19-
import javax.inject.Inject;
19+
import org.springframework.beans.factory.annotation.Autowired;
2020
import org.springframework.transaction.annotation.Transactional;
2121
import reactor.core.publisher.Flux;
2222
import reactor.core.publisher.Mono;
2323

2424
@Transactional
2525
public class CustomerDaoImpl implements CustomerDao {
2626

27-
@Inject R2DBCQueryFactory queryFactory;
27+
@Autowired R2DBCQueryFactory queryFactory;
2828

2929
final QBean<CustomerAddress> customerAddressBean =
3030
bean(
@@ -73,7 +73,6 @@ public Mono<Customer> insert(Customer c) {
7373
id -> {
7474
c.setId(id);
7575

76-
R2DBCInsertClause insert = queryFactory.insert(customerAddress);
7776
return Flux.fromIterable(c.getAddresses())
7877
.flatMap(
7978
ca -> {
@@ -94,15 +93,14 @@ public Mono<Customer> insert(Customer c) {
9493
})
9594
.map(
9695
ca ->
97-
insert
96+
queryFactory.insert(customerAddress)
9897
.set(customerAddress.customerId, id)
9998
.set(customerAddress.addressId, ca.getAddress().getId())
10099
.set(customerAddress.addressTypeCode, ca.getAddressTypeCode())
101100
.set(customerAddress.fromDate, ca.getFromDate())
102101
.set(customerAddress.toDate, ca.getToDate())
103-
.addBatch())
102+
.execute())
104103
.collectList()
105-
.flatMap(__ -> insert.execute())
106104
.map(__ -> c);
107105
});
108106
}
@@ -160,9 +158,8 @@ public Mono<Customer> update(Customer c) {
160158
ca.getAddressTypeCode())
161159
.set(customerAddress.fromDate, ca.getFromDate())
162160
.set(customerAddress.toDate, ca.getToDate())
163-
.addBatch())
161+
.execute())
164162
.collectList()
165-
.flatMap(___ -> insert.execute())
166163
.map(___ -> c);
167164
});
168165
});

0 commit comments

Comments
 (0)