Commit Graph

227 Commits

Author SHA1 Message Date
Mark Paluch
228c6748bf #316 - Adapt to Mockito 3.3.
Mockito reports falsely unnecessary stubbings so we're switching to the silent runner for these cases.
2020-03-11 09:04:40 +01:00
Jens Schauder
ed297c08fe #289 - Polishing.
Refactored DefaultDatabaseClientUnitTests in order to make the relevant differences in setup easier to spot.
Formatting and nullability annotations.

Original pull request: #307.
2020-03-10 16:15:02 +01:00
Mark Paluch
0e5a584277 #289 - Add support for Criteria composition.
We now support composition of Criteria objects to create a Criteria from one or more top-level criteria and to compose nested AND/OR Criteria objects:

Criteria.where("name").is("Foo")).and(Criteria.where("name").is("Bar").or("age")
				.lessThan(49).or(Criteria.where("name").not("Bar").and("age").greaterThan(49))

Original pull request: #307.
2020-03-10 16:13:37 +01:00
Mark Paluch
b3d00022d5 #42 - Polishing.
Obtain generated ID value only once.
2020-03-05 13:22:21 +01:00
Mark Paluch
341c796816 #42 - Add dialect resolution for r2dbc-mariadb driver.
We now use the MySQL dialect when using the R2DBC MariaDB driver.
2020-03-05 13:21:59 +01:00
Mark Paluch
7ed68ee532 #311 - Use R2dbcMappingContext in AbstractR2dbcConfiguration instead of RelationalMappingContext.
We use now a more concrete type in the configuration to avoid clashes when Spring Data JDBC is on the class path.
2020-02-20 10:42:28 +01:00
Mark Paluch
6027e29305 #164 - Support @Query definitions with SpEL expressions.
We now support SpEL expressions in string-based queries to bind parameters for more dynamic queries. SpEL expressions are enclosed in :#{…} and rendered as synthetic named parameter so their values are substituted with bound parameters to avoid SQL injection attach vectors.

interface PersonRepository extends Repository<Person, String> {

	@Query("SELECT * FROM person WHERE lastname = :#{'hello'}")
	Mono<Person> findHello();

	@Query("SELECT * FROM person WHERE lastname = :#{[0]} and firstname = :firstname")
	Mono<Person> findByLastnameAndFirstname(@Param("value") String value, @Param("firstname") String firstname);

	@Query("SELECT * FROM person WHERE lastname = :#{#person.name}")
	Mono<Person> findByExample(@Param("person") Person person);
}
2020-02-20 10:36:18 +01:00
Mark Paluch
714dec3c94 #310 - Fix bind marker reuse when expanding collection arguments using named parameters.
We now correctly reuse bind markers for named parameter substitution when using collection arguments to create dynamic argument lists. Previously, we allocated a new bind marker for each item in the collection which left the parameters intended for reuse unbound.
2020-02-19 12:02:48 +01:00
Mark Paluch
5a5a5fec9e #290 - Add Kotlin extensions for fluent R2dbcEntityTemplate API. 2020-02-17 17:38:47 +01:00
Mark Paluch
1e64c6461a #300 - Extend unit tests for QueryMapper. 2020-02-17 17:19:36 +01:00
Mark Paluch
bfff1f4aaa #298 - Refine documentation regarding Converter behavior for collections. 2020-02-17 13:09:25 +01:00
Mark Paluch
1e667fc242 #303 - Add note about boxed primitives when implementing custom converters. 2020-02-17 13:01:43 +01:00
Mark Paluch
b9b764b5dd #306 - Polishing.
Enable ignored tests that are no longer required to be disabled.
2020-02-17 12:58:07 +01:00
Mark Paluch
2b024dfd10 #306 - Upgrade to JAsync 1.0.14.
Also enable ignored tests.
2020-02-17 12:57:42 +01:00
Mark Paluch
8828ebb11d #305 - Consistently apply registered converters.
We now apply registered write converters to bindable values that are bound via bind(…) or provided through the Criteria/Update API.
2020-02-17 12:48:47 +01:00
Mark Paluch
6051ab11ae #302 - Add documentation for entity-state detection. 2020-02-14 13:50:31 +01:00
Mark Paluch
f3e8f37890 #280 - Prepare 1.1 M3 (Neumann). 2020-02-12 14:46:56 +01:00
Mark Paluch
1313915489 #280 - Updated changelog. 2020-02-12 14:46:53 +01:00
Mark Paluch
f5b9d658d9 #296 - Rename DatabaseClient bean to r2dbcDatabaseClient. 2020-02-12 14:29:06 +01:00
Mark Paluch
1e1888245f #220 - Polishing.
Update what's new section.
2020-02-12 14:25:18 +01:00
Jens Schauder
49a4ff3189 #220 - Polishing.
Formatting.
Fix warnings.
JavaDoc.
Adjusted nullability annotations.

Original pull request: #287.
2020-02-12 14:23:06 +01:00
Mark Paluch
01eccbbbd7 #220 - Refactor StatementMapper.
Use limit/offset instead of Page and accept Expression objects to declare a select list. Use SqlIdentifier in Update, Query, Criteria and fluent API.

Original pull request: #287.
2020-02-12 14:23:03 +01:00
Mark Paluch
64387d1776 #220 - Add Fluent API for EntityOperations.
Original pull request: #287.
2020-02-12 14:23:02 +01:00
Mark Paluch
8313630da8 #220 - Use EntityOperations in SimpleR2dbcRepository.
Original pull request: #287.
2020-02-12 14:23:00 +01:00
Mark Paluch
b5445b8c3f #220 - Introduce R2dbcEntityTemplate.
We now provide a Template API that exposes entity-centric methods. It complements DatabaseClient's simple object mapper methods.

Original pull request: #287.
2020-02-12 14:22:50 +01:00
Mark Paluch
0c1816c8a2 #291 - Adapt to SqlIdentifier changes in Spring Data Relational.
We now use SqlIdentifier to encapsulate the table and column name across the API. The fluent DatabaseClient API accepts the table name and select column projections as SqlIdentifier. The Criteria API remains String-based as names for Query and Update objects may reference either column names or property names.

QueryMapper and UpdateMapper require now a R2DBC dialect object to be constructed. R2dbcMappingContext is configured in a way to not require quoting to preserve backwards compatibility.
2020-01-28 14:00:06 +01:00
Mark Paluch
8f1fe60d71 #283 - Fix Id property and column name usage in SimpleR2dbcRepository.
We now use the Id property name when using the converter to map property names to column names. In other places, where we don't use the converter, we stick with the Id column name.
2020-01-23 09:18:52 +01:00
Mark Paluch
00cc9120e6 #284 - Do not create PersistentEntity for UUID.
We now no longer create a PersistentEntity for UUID as UUID is a simple type and introspection on Java 9+ causes illegal access warnings.
2020-01-23 08:48:11 +01:00
Mark Paluch
851cbafa5f #260 - Support interface projections with DatabaseClient.as(…).
We now support interface projections when using as(Class) through ProjectionFactory. Simple, type-less queries (execute, select from table) are backed by Map implementations and require the projection type to return a similar type than the expected value. Simple types (such as numeric types) are converted between the backing result and the projection. Conversion of complex types requires a source with type information such as a typed select (select().from(Person.class).as(PersonProjection.class)) to apply registered converters on property-level.
2020-01-22 15:49:38 +01:00
Mark Paluch
d636859582 #278 - Prepare 1.1 M2 (Neumann). 2020-01-17 09:38:43 +01:00
Mark Paluch
ab27302516 #278 - Updated changelog. 2020-01-17 09:38:39 +01:00
Mark Paluch
4fb4e1a636 #249 - Prepare 1.1 M1 (Neumann). 2020-01-16 16:05:03 +01:00
Mark Paluch
015c358cee #249 - Updated changelog. 2020-01-16 16:05:01 +01:00
Mark Paluch
7ec3d28b17 #270 - Update copyright years to 2020. 2020-01-07 09:12:00 +01:00
Mark Paluch
2b4244ec64 #252 - Polishing.
Remove unused code.
2019-12-09 10:48:08 +01:00
Mark Paluch
aea4f4e95c #252 - Fix EnumSet conversion.
We now convert properly collections of enum values for read and write.
2019-12-09 10:48:08 +01:00
Mark Paluch
507340ea48 #250 - Throw IllegalArgumentException in StatementMapper if UPDATE contains no assignments.
We now properly throw an IllegalArgumentException. Previously, the update object was attempted to being mapped and this failed as the update object was null.
2019-12-09 09:36:48 +01:00
Mark Paluch
d2f48e9466 #205 - Prepare 1.0 GA. 2019-12-06 11:12:46 +01:00
Mark Paluch
10f44c937d #205 - Updated changelog. 2019-12-06 11:12:46 +01:00
Mark Paluch
a1a217a34c #205 - Polishing.
Tweak javadoc and reference documentation.
2019-12-06 11:12:16 +01:00
Mark Paluch
f2a76fa74f #139 - Consider value type in Dialect-specific array type conversion.
We now inspect the value type of a SettableValue before attempting to convert a value into an array type. This check allows applying custom conversions to map objects to a simple type and bypassing the array conversion afterwards.

Previously, we just relied on the property type without checking whether the value qualifies for array type conversion.
2019-12-06 10:36:04 +01:00
Mark Paluch
d9e425ae17 #195 - Add test for Update with multiple assignments. 2019-12-06 09:41:18 +01:00
Mark Paluch
97ef1ed8b7 #244 - Add Reactor Checkpoint operator for SQL execution.
We now integrate with Reactor's checkpoint operator to include more information for debugging.
2019-12-02 11:12:59 +01:00
Mark Paluch
86ce98d08d #243 - Polishing.
Add author tags. Extend test. Reformat code.
2019-12-02 08:56:57 +01:00
Ferdinand Jacobs
38bbd4838e #243 - Add unit test for rowsUpdated.
rowsUpdated should always emit a single value.
2019-12-02 08:56:54 +01:00
Jens Schauder
887f0ae289 #237 - Polishing.
Removed superfluous package name from `@Query` usage.

Original pull request: #238.
2019-11-28 14:42:09 +01:00
Mark Paluch
ecc0fca306 #237 - Move @Query annotation to o.s.d.r2dbc.repository.
Original pull request: #238.
2019-11-28 14:41:57 +01:00
Jens Schauder
d442fca38d #235 - Polishing.
Added test and tweaked documentation to clarify that other numeric types beyond `Integer` are admissible.
Split a test in order to have meaningful test names.

Original pull request: #238.
2019-11-28 14:41:34 +01:00
Mark Paluch
6d37fde4c7 #235 - Add Modifying query annotation.
We now support returning the affected rows count for repository query methods that are annotated with the Modifying annotation. A modifying query method can return either the affected row count, a boolean value whether at least one row was updated or suppress value emission.

    @Query("UPDATE person SET firstname = :firstname where lastname = :lastname")
    Mono<Integer> setFixedFirstnameFor(String firstname, String lastname);

Original pull request: #238.
2019-11-28 14:33:38 +01:00
Mark Paluch
4801a4fbc2 #232 - Guard Repository.save(…) with provided Id with TransientDataAccessException if row does not exist.
We now emit a TransientDataAccessException if an object with a provided Id yields no affected rows. Such an arrangement is typically an indicator for a bug where calling code expects the object to be inserted with a provided Id.
2019-11-28 10:17:20 +01:00