272 Commits

Author SHA1 Message Date
Mark Paluch
55a6ae0a2a #37 - Updated changelog. 2019-05-14 10:31:49 +02:00
Mark Paluch
430d984503 #109 - Fix simple type conversion for projection queries.
We now correctly consider built-in converters for simple types that are read through DatabaseClient. Simple type projections typically select a single column and expect a result stream of simple values such as selecting a count and retrieving a Mono<Long>.
2019-05-14 09:35:46 +02:00
Mark Paluch
4a46692dfe #117 - Upgrade to jasync-sql 0.9.51. 2019-05-14 09:12:26 +02:00
Oliver Drotbohm
49fb08dc7d #116 - Upgrade to R2DBC 0.8 M8. 2019-05-13 19:43:58 +02:00
Oliver Drotbohm
a5c72a61b4 #115 - Upgrade to Spring Data Moore M4.
Upgraded Spring Data parent, Commons and Relational modules to Moore M4 versions.
2019-05-13 18:22:33 +02:00
Oliver Drotbohm
c456af0d2a #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.
2019-05-09 18:11:55 +02:00
Christoph Strobl
988b31b33a #107 - Polishing.
Extract method references for better readability. Add missing tests and update documentation.
Add delay for transactional MySql tests to avoid failures due to potentially delayed transaction id storage within the database.

Original Pull Request: #107
2019-05-09 08:26:07 +02:00
Mark Paluch
79e32941b5 #107 - Add support for ConnectionFactoryTransactionManager.ConnectionFactoryTransactionManager.
We now support R2DBC transaction management through ConnectionFactoryTransactionManager which is a ReactiveTransactionManager implementation to be used with TransactionalOperator and Spring's declarative transaction management.

ConnectionFactoryTransactionManager tm = new ConnectionFactoryTransactionManager(connectionFactory);
TransactionalOperator operator = TransactionalOperator.create(tm);
DatabaseClient db = DatabaseClient.create(connectionFactory);

Mono<Void> atomicOperation = db.execute().sql("INSERT INTO person (id, name, age) VALUES(:id, :name, :age)")
            .bind("id", "joe")
            .bind("name", "Joe")
            .bind("age", 34)
            .fetch().rowsUpdated()
            .then(db.execute().sql("INSERT INTO contacts (id, name) VALUES(:id, :name)")
                    .bind("id", "joe")
                    .bind("name", "Joe")
                    .fetch().rowsUpdated())
            .then()
            .as(operator::transactional);

Original Pull Request: #107
2019-05-09 07:56:23 +02:00
Oliver Drotbohm
da53a9a934 #64 - Polishing.
Incorporated feedback from review. Polished documentation and Javadoc. Minor code improvements restructuring for better readability. Removed unused methods types. Some polishing for compiler warnings.

Original pull request: #106.
2019-05-08 10:45:30 +02:00
Jens Schauder
361d801b14 #64 - Polishing.
Fixed typos, formatting and minor errors in documentation.

Original pull request: #106.
2019-05-08 10:45:30 +02:00
Mark Paluch
774d2e8b09 #64 - API polishing.
Document fluent API. Add fluent API for update. Introduce StatementMapper. Migrate Insert to StatementMapper. Refactoring and cleanup. Migrate Select to StatementMapper.

Original pull request: #106.
2019-05-08 10:45:30 +02:00
Mark Paluch
ff69a41162 #64 - Split documentation for R2DBC core into parts.
Original pull request: #106.
2019-05-08 10:45:30 +02:00
Mark Paluch
fd4472aaaa #64 - Add Criteria API.
We now support Criteria creation and mapping to express where conditions with a fluent API.

databaseClient.select().from("legoset")
  .where(Criteria.of("name").like("John%").and("id").lessThanOrEquals(42055));

databaseClient.delete()
  .from(LegoSet.class)
  .where(Criteria.of("id").is(42055))
  .then()

databaseClient.delete()
  .from(LegoSet.class)
  .where(Criteria.of("id").is(42055))
  .fetch()
  .rowsUpdated()

Original pull request: #106.
2019-05-08 10:45:30 +02:00
Mark Paluch
88945d7d71 #73 - Introduce BindTarget.
We now apply bindings to a BindTarget that can be overridden without the need to implement all Statement methods.

PreparedOperation no longer has a direct dependency on R2DBC Statement.

Original pull request: #82.
2019-05-06 13:50:36 +02:00
Jens Schauder
02e0cb5026 #73 - Polishing.
Original pull request: #82.
2019-05-06 13:50:33 +02:00
Mark Paluch
ef2d885b1e #73 - Introduce PreparedOperation.
We now encapsulate prepared operations from the StatementFactory within PreparedOperation that renders SQL and provides binding values.

StatementFactory supports SELECT/INSERT/UPDATE/DELETE statement creation considering Dialect-specific rendering.
StatementFactory replaces String-based statement methods in ReactiveDataAccessStrategy.

PreparedOperation<Update> operation = accessStrategy.getStatements().update(entity.getTableName(), binder -> {
	binder.bind("name", "updated value");
	binder.filterBy("id", SettableValue.from(42));
});

databaseClient.execute().sql(operation).then();

Original pull request: #82.
2019-05-06 13:50:20 +02:00
Mark Paluch
72ffccbfbc #100 - Remove Spring JDBC as mandatory dependency.
We now ship our own SqlProvider variant to not require Spring JDBC as mandatory dependency. Spring JDBC can be provided optionally to use SQL-code based exception translation.
2019-04-24 14:40:54 +02:00
Jens Schauder
f7d3124c63 #57 - Added tests for the exception message.
Original pull request: #97.
2019-04-24 08:20:11 +02:00
Mark Paluch
e161476d1c #57 - Add support for R2DBC subclass exception translation.
We now use R2DBC's exception hierarchy to translate exceptions into Spring's DataAccessException hierarchy.

Original pull request: #97.
2019-04-24 08:19:34 +02:00
Mark Paluch
9c6142f941 #95 - Use customized ConnectionFactory lookup to avoid AbstractR2dbcConfiguration proxying.
We now attempt to lookup ConnectionFactory from ApplicationContext and fall back to a local
method call if ConnectionFactory is not exposed as bean.

Original pull request: #96.
2019-04-18 08:58:21 +02:00
Jens Schauder
6227d96341 #75 - Polishing.
Clarified code a little.

Added a warning to `AnonymousBindMarkers`:

 Anonymous bind markers are problematic because the have to appear in generated SQL in the same order they get generated.
 This might cause challenges in the future with complex generate statements.
 For example those containing subselects which limit the freedom of arranging bind markers.

Original pull request: #84.
2019-04-17 16:23:50 +02:00
Mark Paluch
c9435c8797 #75 - Polishing.
Unify connection creation by providing JDBC URL. Obtain R2DBC ConnectionFactory using connection factory discovery.

Original pull request: #84.
2019-04-17 16:23:40 +02:00
Mark Paluch
3ca32b89b7 #75 - Add support for MySQL using jasync-mysql.
We now support MySQL through the jasync-mysql driver that exposes its asynchronous functionality through a R2DBC wrapper implementation.

Jasync uses for now its own exceptions.

Original pull request: #84.
2019-04-17 16:23:30 +02:00
Mark Paluch
08d91bdf84 #75 - Add anonymous indexed bind markers.
Anonymous indexed bind markers come with a static placeholder symbol for all parameter occurrences and they are bound by index.

Original pull request: #84.
2019-04-17 16:23:19 +02:00
Jens Schauder
2f5d11bd56 #90 - Polishing.
Original pull request: #90.
2019-04-17 13:00:40 +02:00
Mark Paluch
cca38b4480 #90 - Add additional subclasses to test against H2.
We now run all of our integration test also against H2.

Original pull request: #90.
2019-04-17 13:00:19 +02:00
Mark Paluch
652facb14a #90 - Emit inserted object through SimpleR2dbcRepository.save(…) with given Id.
SimpleR2dbcRepository.save(…) now falls back to the saved object as emitted result if the INSERT statement does not return generated keys.

Adding H2 database engine for tests to simulate such behavior.

Original pull request: #90.
2019-04-17 12:59:51 +02:00
Sebastien Deleuze
30fb4d57b9 #91 - Add RowsFetchSpec<T>.flow() extension.
Original pull request: #91.
2019-04-09 15:37:15 +02:00
Mark Paluch
591072f93c #86 - Polishing
Remove unused imports.

Original pull request: #86.
2019-04-03 09:43:02 +02:00
Sebastien Deleuze
372f5f02d4 #86 - Polishing.
Convert idents to tabs. Fix Kotlin extensions formatting.

Original pull request: #86.
2019-04-03 09:42:48 +02:00
Sebastien Deleuze
43a74cae31 #86 - Add non-nullable variant to RowsFetchSpec extensions.
This commit is a follow-up of gh-63.

Original pull request: #86.
2019-04-03 09:42:36 +02:00
Mark Paluch
7c9e777d00 #85 - Consider BigDecimal and BigInteger as simple types.
We now consider BigDecimal and BigInteger as simple types and no longer as entities.

We also no longer set properties whose value is null.
2019-04-02 16:03:59 +02:00
Spring Operator
7e3bcceeda #79 - URL Cleanup.
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* [ ] http://www.apache.org/licenses/ with 1 occurrences migrated to:
  https://www.apache.org/licenses/ ([https](https://www.apache.org/licenses/) result 200).
* [ ] http://www.apache.org/licenses/LICENSE-2.0 with 93 occurrences migrated to:
  https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200).

Original pull request: #79.
2019-03-22 10:14:40 +01:00
Spring Operator
37bb12cfef #76 - URL Cleanup.
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed But Review Recommended
These URLs were fixed, but the https status was not OK. However, the https status was the same as the http request or http redirected to an https URL, so they were migrated. Your review is recommended.

* [ ] http://www.reactive-streams.org/reactive-streams- (404) with 1 occurrences migrated to:
  https://www.reactive-streams.org/reactive-streams- ([https](https://www.reactive-streams.org/reactive-streams-) result 404).

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* [ ] http://docs.spring.io/spring/docs/ with 7 occurrences migrated to:
  https://docs.spring.io/spring/docs/ ([https](https://docs.spring.io/spring/docs/) result 200).
* [ ] http://github.com/spring-projects/spring-data-r2dbc with 1 occurrences migrated to:
  https://github.com/spring-projects/spring-data-r2dbc ([https](https://github.com/spring-projects/spring-data-r2dbc) result 200).
* [ ] http://pivotal.io/ with 1 occurrences migrated to:
  https://pivotal.io/ ([https](https://pivotal.io/) result 200).
* [ ] http://projects.spring.io/spring-data-r2dbc/ with 1 occurrences migrated to:
  https://projects.spring.io/spring-data-r2dbc/ ([https](https://projects.spring.io/spring-data-r2dbc/) result 200).
* [ ] http://repo.spring.io/milestone/org/springframework/data/ with 1 occurrences migrated to:
  https://repo.spring.io/milestone/org/springframework/data/ ([https](https://repo.spring.io/milestone/org/springframework/data/) result 200).
* [ ] http://spring.io with 1 occurrences migrated to:
  https://spring.io ([https](https://spring.io) result 200).
* [ ] http://spring.io/blog with 2 occurrences migrated to:
  https://spring.io/blog ([https](https://spring.io/blog) result 200).
* [ ] http://spring.io/docs with 1 occurrences migrated to:
  https://spring.io/docs ([https](https://spring.io/docs) result 200).
* [ ] http://spring.io/projects/spring-data-r2dbc with 4 occurrences migrated to:
  https://spring.io/projects/spring-data-r2dbc ([https](https://spring.io/projects/spring-data-r2dbc) result 200).
* [ ] http://stackoverflow.com/questions/tagged/spring-data with 2 occurrences migrated to:
  https://stackoverflow.com/questions/tagged/spring-data ([https](https://stackoverflow.com/questions/tagged/spring-data) result 200).
* [ ] http://stackoverflow.com/questions/tagged/spring-data-r2dbc with 1 occurrences migrated to:
  https://stackoverflow.com/questions/tagged/spring-data-r2dbc ([https](https://stackoverflow.com/questions/tagged/spring-data-r2dbc) result 200).
* [ ] http://twitter.com/SpringData with 1 occurrences migrated to:
  https://twitter.com/SpringData ([https](https://twitter.com/SpringData) result 200).
* [ ] http://contributor-covenant.org with 1 occurrences migrated to:
  https://contributor-covenant.org ([https](https://contributor-covenant.org) result 301).
* [ ] http://contributor-covenant.org/version/1/3/0/ with 1 occurrences migrated to:
  https://contributor-covenant.org/version/1/3/0/ ([https](https://contributor-covenant.org/version/1/3/0/) result 301).
* [ ] http://help.github.com/forking/ with 1 occurrences migrated to:
  https://help.github.com/forking/ ([https](https://help.github.com/forking/) result 301).
* [ ] http://projects.spring.io/spring-data with 1 occurrences migrated to:
  https://projects.spring.io/spring-data ([https](https://projects.spring.io/spring-data) result 301).
* [ ] http://repo.spring.io/libs-milestone with 1 occurrences migrated to:
  https://repo.spring.io/libs-milestone ([https](https://repo.spring.io/libs-milestone) result 302).
2019-03-21 09:43:30 +01:00
Spring Operator
6127a51090 #74 - URL Cleanup.
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* http://maven.apache.org/xsd/maven-4.0.0.xsd with 1 occurrences migrated to:
  https://maven.apache.org/xsd/maven-4.0.0.xsd ([https](https://maven.apache.org/xsd/maven-4.0.0.xsd) result 200).

# Ignored
These URLs were intentionally ignored.

* http://maven.apache.org/POM/4.0.0 with 2 occurrences
* http://www.w3.org/2001/XMLSchema-instance with 1 occurrences
2019-03-20 15:50:56 +01:00
Mark Paluch
6654db34c4 #59 - Consider custom conversion in MappingR2dbcConverter.
MappingR2dbcConverter now considers custom conversions for inbound and outbound conversion of top-level types (Row to Entity, Entity to OutboundRow) and on property level (e.g. convert an object to String and vice versa).

Original pull request: #70.
2019-03-18 15:24:48 +01:00
Mark Paluch
39936c67fa #59 - Simplify CustomConversions bean construction.
Original pull request: #70.
2019-03-18 15:24:18 +01:00
Spring Operator
6fab5e65ea URL Cleanup
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were fixed successfully.

* http://projects.spring.io/spring-data-r2dbc migrated to:
  https://projects.spring.io/spring-data-r2dbc ([https](https://projects.spring.io/spring-data-r2dbc) result 301).

# Ignored
These URLs were intentionally ignored.

* http://maven.apache.org/POM/4.0.0
* http://maven.apache.org/xsd/maven-4.0.0.xsd
* http://www.w3.org/2001/XMLSchema-instance
2019-03-10 11:37:21 +01:00
Mark Paluch
369522231f #41 - Polishing.
Rename RowDataConverter to R2dbcConverters. Introduce R2dbcSimpleTypeHolder. Apply custom conversions check in MappingR2dbcConverter. Extend tests.

Original pull request: #65.
2019-03-10 11:34:59 +01:00
Hebert Coelho
455e9a59de #41 - Add R2DBC converters.
Original pull request: #65.
2019-03-10 11:34:37 +01:00
Mark Paluch
feabe477a7 #61 - Move Conversion-related functionality to MappingR2dbcConverter.
All conversion functionality is now pulled together into MappingR2dbcConverter.

Introduce OutboundRow to provide mapping between column names and settable values. Remove identifier from SettableValue.

Original pull request: #62.
2019-03-05 14:03:43 +01:00
Jens Schauder
169de9df0a #56 - Polishing.
Replaced calls to `SqlRenderer.render(.)` with `SqlRenderer.toString(.)`.
And code formatting.

Original pull request: #66.
2019-03-05 13:48:31 +01:00
Mark Paluch
c241cd982e #56 - Use Statement Builder API for SELECT statements.
Original pull request: #66.
2019-03-05 13:36:27 +01:00
Mark Paluch
2cefdc8bdd #63 - Polishing.
Convert spaces to tabs. Replace version strings with managed dependencies. Javadoc.

Original pull request: #63.
2019-02-21 13:38:31 +01:00
Sebastien Deleuze
66b84d23f1 #63 - Add DatabaseClient Coroutines extensions.
This commit introduces Coroutines support for `DatabaseClient`
functional API via Kotlin extensions that provide suspendable
functions prefixed by `await` for `Mono` based APIs.

Extensions for `Flux` will be added when Kotlin/kotlinx.coroutines#254
will be fixed.

It also provides `asType<Foo>()` extensions useful for Reactive API
as well.

Original pull request: #63.
2019-02-21 13:38:14 +01:00
Mark Paluch
b53437b59d #60 - Use R2DBC's BOM for dependency management. 2019-02-14 13:37:33 +01:00
Mark Paluch
4423e038c0 #54 - Upgrade to R2DBC 1.0 M7. 2019-02-11 10:06:55 +01:00
Mark Paluch
432b885853 #54 - Build against R2DBC 1.0 snapshots. 2019-02-01 09:43:51 +01:00
Mark Paluch
3a5278ce87 #52 - Switch mssql-jdbc driver dependency to test scope.
We use JDBC drivers only during testing so converting mssql-jdbc to a test-only dependency.
2019-01-21 08:55:10 +01:00
Mark Paluch
3d1041c0c8 #23 - Address review comments.
Original pull request: #47.
2019-01-18 14:00:30 +01:00