Skip to content

Commit c456af0

Browse files
committed
#111 - Package and type renames.
Package renames: - `….domain` -> `….mapping` - `….function.connectionfactory` -> `connectionfactory` - `….function.convert` -> `convert` - `….function.query` -> `query` - `….function` -> `….core` Type moves: - `….dialect.R2dbcSimpleTypeHolder` -> `….mapping.R2dbcSimpleTypeHolder` - `….mapping.BindTarget` -> `….dialect.BindTarget` - `….mapping.PreparedOperation` -> `….core.PreparedOperation` - `….mapping.QueryOperation` -> `….core.QueryOperation` - `….mapping.BindOperation` -> `….core.BindOperation` - `….connectionfactory.ConnectionFactoryTransactionManager` -> `….connectionfactory.R2dbcTransactionManager` That makes us end up with: - `connectionfactory` - `core` -> `connectionfactory`, `convert`, `dialect`, `mapping`, `query` - `query` -> `convert`, `dialect`, `mapping` - `convert` -> `dialect`, `mapping` - `dialect` -> `mapping` - `mapping` -> Spring Data Commons mapping Reflect type renames in reference documentation.
1 parent 988b31b commit c456af0

File tree

124 files changed

+388
-365
lines changed

Some content is hidden

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

124 files changed

+388
-365
lines changed

src/main/asciidoc/reference/r2dbc-core.adoc

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -140,31 +140,31 @@ public class R2dbcApp {
140140
DatabaseClient client = DatabaseClient.create(connectionFactory);
141141
142142
client.execute()
143-
.sql("CREATE TABLE person" +
144-
"(id VARCHAR(255) PRIMARY KEY," +
145-
"name VARCHAR(255)," +
146-
"age INT)")
147-
.fetch()
148-
.rowsUpdated()
149-
.as(StepVerifier::create)
150-
.expectNextCount(1)
151-
.verifyComplete();
143+
.sql("CREATE TABLE person" +
144+
"(id VARCHAR(255) PRIMARY KEY," +
145+
"name VARCHAR(255)," +
146+
"age INT)")
147+
.fetch()
148+
.rowsUpdated()
149+
.as(StepVerifier::create)
150+
.expectNextCount(1)
151+
.verifyComplete();
152152
153153
client.insert()
154-
.into(Person.class)
155-
.using(new Person("joe", "Joe", 34))
156-
.then()
157-
.as(StepVerifier::create)
158-
.verifyComplete();
154+
.into(Person.class)
155+
.using(new Person("joe", "Joe", 34))
156+
.then()
157+
.as(StepVerifier::create)
158+
.verifyComplete();
159159
160160
client.select()
161-
.from(Person.class)
162-
.fetch()
163-
.first()
164-
.doOnNext(it -> log.info(it))
165-
.as(StepVerifier::create)
166-
.expectNextCount(1)
167-
.verifyComplete();
161+
.from(Person.class)
162+
.fetch()
163+
.first()
164+
.doOnNext(it -> log.info(it))
165+
.as(StepVerifier::create)
166+
.expectNextCount(1)
167+
.verifyComplete();
168168
}
169169
}
170170
----

src/main/asciidoc/reference/r2dbc-databaseclient.adoc

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ Once built, a `DatabaseClient` instance is immutable. However, you can clone it
3434
[source,java]
3535
----
3636
DatabaseClient client1 = DatabaseClient.builder()
37-
.exceptionTranslator(exceptionTranslatorA).build();
37+
.exceptionTranslator(exceptionTranslatorA).build();
3838
3939
DatabaseClient client2 = client1.mutate()
40-
.exceptionTranslator(exceptionTranslatorB).build();
40+
.exceptionTranslator(exceptionTranslatorB).build();
4141
----
4242

4343
== Controlling Database Connections
@@ -98,12 +98,14 @@ You can extend `SqlErrorCodeR2dbcExceptionTranslator`, as the following example
9898
----
9999
public class CustomSqlErrorCodeR2dbcExceptionTranslator extends SqlErrorCodeR2dbcExceptionTranslator {
100100
101-
protected DataAccessException customTranslate(String task, String sql, R2dbcException r2dbcex) {
102-
if (sqlex.getErrorCode() == -12345) {
103-
return new DeadlockLoserDataAccessException(task, r2dbcex);
104-
}
105-
return null;
101+
protected DataAccessException customTranslate(String task, String sql, R2dbcException r2dbcex) {
102+
103+
if (sqlex.getErrorCode() == -12345) {
104+
return new DeadlockLoserDataAccessException(task, r2dbcex);
106105
}
106+
107+
return null;
108+
}
107109
}
108110
----
109111

@@ -115,10 +117,11 @@ The following example shows how you can use this custom translator:
115117
----
116118
ConnectionFactory connectionFactory = …;
117119
118-
CustomSqlErrorCodeR2dbcExceptionTranslator exceptionTranslator = new CustomSqlErrorCodeR2dbcExceptionTranslator();
120+
CustomSqlErrorCodeR2dbcExceptionTranslator exceptionTranslator =
121+
new CustomSqlErrorCodeR2dbcExceptionTranslator();
119122
120123
DatabaseClient client = DatabaseClient.builder()
121-
.connectionFactory(connectionFactory)
122-
.exceptionTranslator(exceptionTranslator)
123-
.build();
124+
.connectionFactory(connectionFactory)
125+
.exceptionTranslator(exceptionTranslator)
126+
.build();
124127
----

src/main/asciidoc/reference/r2dbc-fluent.adoc

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ Let's take a look at a simple query:
1212
[source,java]
1313
----
1414
Flux<Person> people = databaseClient.select()
15-
.from(Person.class) <1>
16-
.fetch()
17-
.all(); <2>
15+
.from(Person.class) <1>
16+
.fetch()
17+
.all(); <2>
1818
----
1919
<1> Using `Person` with the `from(…)` method sets the `FROM` table based on mapping metadata. It also maps tabular results on `Person` result objects.
2020
<2> Fetching `all()` rows returns a `Flux<Person>` without limiting results.
@@ -26,13 +26,13 @@ The following example declares a more complex query that specifies the table nam
2626
[source,java]
2727
----
2828
Mono<Person> first = databaseClient.select()
29-
.from("legoset") <1>
30-
.matching(where("firstname").is("John") <2>
31-
.and("lastname").in("Doe", "White"))
32-
.orderBy(desc("id")) <3>
33-
.as(Person.class)
34-
.fetch()
35-
.one(); <4>
29+
.from("legoset") <1>
30+
.matching(where("firstname").is("John") <2>
31+
.and("lastname").in("Doe", "White"))
32+
.orderBy(desc("id")) <3>
33+
.as(Person.class)
34+
.fetch()
35+
.one(); <4>
3636
----
3737
<1> Selecting from a table by name returns row results as `Map<String, Object>` with case-insensitive column name matching.
3838
<2> The issued query declares a `WHERE` condition on `firstname` and `lastname` columns to filter results.
@@ -166,9 +166,9 @@ Take a look at a simple typed update operation:
166166
Person modified = …
167167
168168
Mono<Void> update = databaseClient.update()
169-
.table(Person.class) <1>
170-
.using(modified) <2>
171-
.then(); <3>
169+
.table(Person.class) <1>
170+
.using(modified) <2>
171+
.then(); <3>
172172
----
173173
<1> Using `Person` with the `table(…)` method sets the table to update based on mapping metadata.
174174
<2> Provide a scalar `Person` object value. `using(…)` accepts the modified object and derives primary keys and updates all column values.
@@ -181,10 +181,10 @@ Update also support untyped operations:
181181
[source,java]
182182
----
183183
Mono<Void> update = databaseClient.update()
184-
.table("person") <1>
185-
.using(Update.update("firstname", "Jane")) <2>
186-
.matching(where("firstname").is("John")) <3>
187-
.then(); <4>
184+
.table("person") <1>
185+
.using(Update.update("firstname", "Jane")) <2>
186+
.matching(where("firstname").is("John")) <3>
187+
.then(); <4>
188188
----
189189
<1> Update table `person`.
190190
<2> Provide a `Update` definition, which columns to update.
@@ -217,10 +217,10 @@ Take a look at a simple insert operation:
217217
[source,java]
218218
----
219219
Mono<Void> delete = databaseClient.delete()
220-
.from(Person.class) <1>
221-
.matching(where("firstname").is("John") <2>
222-
.and("lastname").in("Doe", "White"))
223-
.then(); <3>
220+
.from(Person.class) <1>
221+
.matching(where("firstname").is("John") <2>
222+
.and("lastname").in("Doe", "White"))
223+
.then(); <3>
224224
----
225225
<1> Using `Person` with the `from(…)` method sets the `FROM` table based on mapping metadata.
226226
<2> The issued query declares a `WHERE` condition on `firstname` and `lastname` columns to filter rows to delete.

src/main/asciidoc/reference/r2dbc-repositories.adoc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,16 @@ Consequently, you can retrieve all `Person` objects would resemble the following
7474
@ContextConfiguration
7575
public class PersonRepositoryTests {
7676
77-
@Autowired PersonRepository repository;
77+
@Autowired PersonRepository repository;
7878
79-
@Test
80-
public void readsAllEntitiesCorrectly() {
79+
@Test
80+
public void readsAllEntitiesCorrectly() {
8181
82-
repository.findAll()
83-
.as(StepVerifier::create)
84-
.expectNextCount(1)
85-
.verifyComplete();
86-
}
82+
repository.findAll()
83+
.as(StepVerifier::create)
84+
.expectNextCount(1)
85+
.verifyComplete();
86+
}
8787
}
8888
----
8989
====
@@ -104,11 +104,11 @@ Defining such a query is a matter of declaring a method on the repository interf
104104
----
105105
public interface PersonRepository extends ReactiveCrudRepository<Person, Long> {
106106
107-
@Query("SELECT * FROM person WHERE lastname = :lastname")
108-
Flux<Person> findByLastname(String lastname); <1>
107+
@Query("SELECT * FROM person WHERE lastname = :lastname")
108+
Flux<Person> findByLastname(String lastname); <1>
109109
110-
@Query("SELECT firstname, lastname FROM person WHERE lastname = $1")
111-
Mono<Person> findFirstByLastname(String lastname) <2>
110+
@Query("SELECT firstname, lastname FROM person WHERE lastname = $1")
111+
Mono<Person> findFirstByLastname(String lastname) <2>
112112
113113
}
114114
----

src/main/asciidoc/reference/r2dbc-transactions.adoc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ Relational databases typically associate a transaction with a single transport c
66
Using different connections hence results in utilizing different transactions.
77
Spring Data R2DBC includes transaction-awareness in `DatabaseClient` that allows you to group multiple statements within
88
the same transaction using https://docs.spring.io/spring/docs/current/spring-framework-reference/data-access.html#transaction[Spring's Transaction Management].
9-
Spring Data R2DBC provides a implementation for `ReactiveTransactionManager` with `ConnectionFactoryTransactionManager`.
10-
See <<r2dbc.connections.ConnectionFactoryTransactionManager>> for further details.
9+
Spring Data R2DBC provides a implementation for `ReactiveTransactionManager` with `R2dbcTransactionManager`.
10+
See <<r2dbc.connections.R2dbcTransactionManager>> for further details.
1111

1212
.Programmatic Transaction Management
1313
====
1414
[source,java]
1515
----
16-
ReactiveTransactionManager tm = new ConnectionFactoryTransactionManager(connectionFactory);
16+
ReactiveTransactionManager tm = new R2dbcTransactionManager(connectionFactory);
1717
TransactionalOperator operator = TransactionalOperator.create(tm); <1>
1818
1919
DatabaseClient client = DatabaseClient.create(connectionFactory);
@@ -43,7 +43,7 @@ is a less invasive, annotation-based approach to transaction demarcation.
4343
[source,java]
4444
----
4545
@Configuration
46-
@EnableTransactionManagement <1>
46+
@EnableTransactionManagement <1>
4747
class Config extends AbstractR2dbcConfiguration {
4848
4949
@Override
@@ -52,8 +52,8 @@ class Config extends AbstractR2dbcConfiguration {
5252
}
5353
5454
@Bean
55-
ReactiveTransactionManager txMgr(ConnectionFactory connectionFactory) { <2>
56-
return new ConnectionFactoryTransactionManager(connectionFactory);
55+
ReactiveTransactionManager transactionManager(ConnectionFactory connectionFactory) { <2>
56+
return new R2dbcTransactionManager(connectionFactory);
5757
}
5858
}
5959
@@ -83,5 +83,5 @@ class MyService {
8383
}
8484
----
8585
<1> Enable declarative transaction management.
86-
<2> Provide a `ReactiveTransactionManager` implementation to back reactive tansaction features.
86+
<2> Provide a `ReactiveTransactionManager` implementation to back reactive transaction features.
8787
====

src/main/java/org/springframework/data/r2dbc/InvalidResultAccessException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* Exception thrown when a {@link io.r2dbc.spi.Result} has been accessed in an invalid fashion. Such exceptions always
2525
* have a {@link io.r2dbc.spi.R2dbcException} root cause.
2626
* <p>
27-
* This typically happens when an invalid {@link org.springframework.data.r2dbc.function.FetchSpec} column index or name
27+
* This typically happens when an invalid {@link org.springframework.data.r2dbc.core.FetchSpec} column index or name
2828
* has been specified.
2929
*
3030
* @author Mark Paluch

src/main/java/org/springframework/data/r2dbc/config/AbstractR2dbcConfiguration.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
import org.springframework.core.convert.converter.Converter;
2929
import org.springframework.data.convert.CustomConversions;
3030
import org.springframework.data.convert.CustomConversions.StoreConversions;
31+
import org.springframework.data.r2dbc.convert.MappingR2dbcConverter;
32+
import org.springframework.data.r2dbc.convert.R2dbcCustomConversions;
33+
import org.springframework.data.r2dbc.core.DatabaseClient;
34+
import org.springframework.data.r2dbc.core.DefaultReactiveDataAccessStrategy;
35+
import org.springframework.data.r2dbc.core.ReactiveDataAccessStrategy;
3136
import org.springframework.data.r2dbc.dialect.Database;
3237
import org.springframework.data.r2dbc.dialect.Dialect;
33-
import org.springframework.data.r2dbc.function.DatabaseClient;
34-
import org.springframework.data.r2dbc.function.DefaultReactiveDataAccessStrategy;
35-
import org.springframework.data.r2dbc.function.ReactiveDataAccessStrategy;
36-
import org.springframework.data.r2dbc.function.convert.MappingR2dbcConverter;
37-
import org.springframework.data.r2dbc.function.convert.R2dbcCustomConversions;
3838
import org.springframework.data.r2dbc.support.R2dbcExceptionSubclassTranslator;
3939
import org.springframework.data.r2dbc.support.R2dbcExceptionTranslator;
4040
import org.springframework.data.r2dbc.support.SqlStateR2dbcExceptionTranslator;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package org.springframework.data.r2dbc.function.connectionfactory;
16+
package org.springframework.data.r2dbc.connectionfactory;
1717

1818
import io.r2dbc.spi.Connection;
1919
import io.r2dbc.spi.ConnectionFactory;
@@ -35,7 +35,7 @@
3535
* Helper class that provides static methods for obtaining R2DBC Connections from a
3636
* {@link io.r2dbc.spi.ConnectionFactory}.
3737
* <p>
38-
* Used internally by Spring's {@link org.springframework.data.r2dbc.function.DatabaseClient}, Spring's R2DBC operation
38+
* Used internally by Spring's {@link org.springframework.data.r2dbc.core.DatabaseClient}, Spring's R2DBC operation
3939
* objects. Can also be used directly in application code.
4040
*
4141
* @author Mark Paluch
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package org.springframework.data.r2dbc.function.connectionfactory;
16+
package org.springframework.data.r2dbc.connectionfactory;
1717

1818
import io.r2dbc.spi.Connection;
1919

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package org.springframework.data.r2dbc.function.connectionfactory;
16+
package org.springframework.data.r2dbc.connectionfactory;
1717

1818
import io.r2dbc.spi.Connection;
1919
import io.r2dbc.spi.ConnectionFactory;
@@ -22,7 +22,7 @@
2222
import org.springframework.util.Assert;
2323

2424
/**
25-
* Resource holder wrapping a R2DBC {@link Connection}. {@link ConnectionFactoryTransactionManager} binds instances of
25+
* Resource holder wrapping a R2DBC {@link Connection}. {@link R2dbcTransactionManager} binds instances of
2626
* this class to the thread, for a specific {@link ConnectionFactory}.
2727
* <p>
2828
* Inherits rollback-only support for nested R2DBC transactions and reference count functionality from the base class.
@@ -31,7 +31,7 @@
3131
*
3232
* @author Mark Paluch
3333
* @author Christoph Strobl
34-
* @see ConnectionFactoryTransactionManager
34+
* @see R2dbcTransactionManager
3535
* @see ConnectionFactoryUtils
3636
*/
3737
public class ConnectionHolder extends ResourceHolderSupport {
@@ -86,7 +86,7 @@ protected boolean hasConnection() {
8686
/**
8787
* Set whether this holder represents an active, R2DBC-managed transaction.
8888
*
89-
* @see ConnectionFactoryTransactionManager
89+
* @see R2dbcTransactionManager
9090
*/
9191
protected void setTransactionActive(boolean transactionActive) {
9292
this.transactionActive = transactionActive;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package org.springframework.data.r2dbc.function.connectionfactory;
16+
package org.springframework.data.r2dbc.connectionfactory;
1717

1818
import io.r2dbc.spi.Connection;
1919
import io.r2dbc.spi.Wrapped;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package org.springframework.data.r2dbc.function.connectionfactory;
16+
package org.springframework.data.r2dbc.connectionfactory;
1717

1818
import java.util.Map;
1919
import java.util.concurrent.ConcurrentHashMap;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package org.springframework.data.r2dbc.function.connectionfactory;
16+
package org.springframework.data.r2dbc.connectionfactory;
1717

1818
import io.r2dbc.spi.Connection;
1919
import io.r2dbc.spi.ConnectionFactory;

0 commit comments

Comments
 (0)