Commit Graph

185 Commits

Author SHA1 Message Date
Mark Paluch
729222c763 #390 - Polishing.
Add author tags and ticket references to tests.
2020-07-14 15:21:21 +02:00
Zsombor Gegesy
748c5ba993 #390 - Insert should work without giving any explicit assignment/variables.
DatabaseClient.insert() can now persist objects that consist only of an id.
2020-07-14 15:21:20 +02:00
Mark Paluch
7b676a93ce #398 - Upgrade to MySQL JDBC connector 8.0.21. 2020-07-14 15:15:02 +02:00
Mark Paluch
682b6ffa75 #349 - Polishing.
Remove manual query for query derivation with SQL Server.
2020-07-07 14:36:45 +02:00
Mark Paluch
9485c52247 #383 - Polishing.
Use more concise assertions.
2020-06-09 15:26:44 +02:00
Mark Paluch
58708779da #383 - Fix Criteria mapping when composing a group from top-level criteria.
Using Criteria.from(…) with multiple Criteria objects now uses properly AND combination along with group nesting to render a correct criteria. Previously, the INITIAL combinator in groups caused a mapping exception.
2020-06-09 15:26:44 +02:00
Mark Paluch
594df7ac17 #384 - Fix return type detection for suspended Kotlin methods.
See DATACMNS-1738 for further reference.
2020-06-09 11:27:52 +02:00
Mark Paluch
02c9a87078 #369 - Fall back to column name in QueryMapper if path expression maps into simple type property.
We now fall back to the column name when resolving a property path expression that maps into a simple-typed property. PropertyPath.from(…) fails internally as it attempts to look up a simple type from the MappingContext and this fails for primitive and simple types.
2020-05-22 09:16:49 +02:00
Mark Paluch
6cf2834a23 #207 - Skip converter registrations for JSR-310 to java.util.Date.
We now prevent converter registrations that enforce a conversion from JSR-310 types to java.util.Date. R2DBC drivers use natively JSR-310 types and some of them don't implement java.util.Date at all.
2020-05-15 11:50:24 +02:00
Mark Paluch
af7dea07ad #329 - Translate driver exceptions in R2dbcTransactionManager. 2020-05-11 16:58:23 +02:00
Mark Paluch
53b84e6a08 #365 - Fix immutable versioned object usage.
We now use the proper object instance when constructing statements for insert/update of versioned entities. Previously, we created a new instance that is associated with the incremented version number but we did not reuse that instance so the version increment remained invisible.
2020-05-11 15:57:51 +02:00
Mark Paluch
6f94ace85a #363 - Polishing.
Fix failing tests.
2020-05-11 15:52:06 +02:00
Jens Schauder
15c64a4ee1 #363 - Polishing.
Added an integration test and tweaked the conversions to make it succeed.
The converter now does not rely on the driver to do the conversion anymore.

Original pull request: #360.
2020-05-11 11:35:30 +02:00
mhyeon-lee
d004bc0dd9 #363 - Count projection support for derived queries.
Original pull request: #360.
2020-05-11 11:27:44 +02:00
Jens Schauder
919d8c663f #364 - Add lock() to Dialect implementation for tests. 2020-05-07 09:39:50 +02:00
Jens Schauder
94f94c6ba0 #93 - Polishing.
Formatting.
Added issue to test comments.

Removed the test for presence of the id in case of a potential optimistic locking exception.
A deleted row is also a case of a concurrent modification and therefore should trigger the OptimisticLockingException.

Original pull request: #314.
2020-04-24 10:48:10 +02:00
orange-buffalo
8e6797dd04 #93 - Adding support for optimistic locking based on @Version column.
Original pull request: #314.
2020-04-24 10:47:17 +02:00
Mark Paluch
75e2ba3ede #354 - Polishing.
Add author tags. Reformat code.

Original pull request: #355.
2020-04-23 14:29:39 +02:00
Louis Morgan
bf19cb36a4 #354 - Allow saving an entity with a read-only collection-like property.
Previously a NullPointerException would be thrown.

Original pull request: #355.
2020-04-23 14:29:26 +02:00
Mark Paluch
8c0d01ae8c #344 - Polishing.
Consider projection properties as SELECT projection. Refactor distinct() into marker method without accepting a boolean flag. Make distinct field final. Update tests.

Original pull request: #346.
2020-04-21 15:32:03 +02:00
Mingyuan Wu
dd7c713980 #344 - Add support for support distinct derived query methods.
We now support distinct derived queries that are useful with projections to retrieve distinct results.

interface UserRepository extends Repository<User, Long> {

  Mono<UserProjection> findDistinctByFirstName(String firstName);

}

interface UserProjection {

  String getFirstName();

}

Original pull request: #346.
2020-04-21 15:31:52 +02:00
Mark Paluch
ea464b2d37 #341 - Polishing.
Consider modifying indicators in query execution. Consider absence of Criteria for delete and update queries. Add test.

Reformat code, update documentation.

Original pull request: #345.
2020-04-21 14:38:48 +02:00
Mingyuan Wu
a210a2ea6f #341 - Add support for derived delete query methods.
Original pull request: #345.
2020-04-21 14:38:39 +02:00
Mark Paluch
d901566ed4 #342 - Polishing.
Remove Kotlin extension for Criteria as it should live in Spring Data Relational. Add author tags. Reformat code.
2020-04-21 14:13:15 +02:00
Mingyuan Wu
be00ea84ef #342 - Move off deprecated Criteria and Update. 2020-04-21 14:13:08 +02:00
Mark Paluch
5c921c56a4 #349 - Fix parameter binding for Between queries.
We now bind the correct parameter when issuing Between queries.
2020-04-21 14:02:11 +02:00
Mark Paluch
ee46695cdd #350 - Use Testcontainers constructor with image name.
Create database containers using the constructor accepting the image name to make sure that the exposed port gets registered. A recent change in Testcontainers caused that the port is no longer registered when using the default constructor.
2020-04-20 09:39:28 +02:00
Mark Paluch
5e1d1b2919 #335 - Consider Pageable in derived queries.
We now consider Pageable arguments in derived queries. Previously only limiting queries (findFirst10) were considered.
2020-04-02 14:20:45 +02:00
Mark Paluch
df7919a98d #318 - Add support for Postgres JSON type.
We now pass-thru Postgres's JSON type that can be used in entities and simple queries.
2020-03-31 12:37:56 +02:00
Mark Paluch
4e5bf95504 #282 - Polishing.
Move query derivation infrastructure to Spring Data Relational. Adapt to newly introduced ValueFunction for deferred value mapping. Use query derivation in integration tests.

Tweak javadoc, add since and author tags, reformat code.

Related ticket: https://jira.spring.io/browse/DATAJDBC-514
Original pull request: #295.
2020-03-27 16:40:56 +01:00
Mark Paluch
a9a3919cf1 #330 - Adapt to Criteria objects in Spring Data Relational. 2020-03-27 16:40:56 +01:00
Roman Chigvintsev
dbe935c45a #282 - Add support for query derivation.
We now support query derivation for R2DBC repositories:

interface ReactivePersonRepository extends ReactiveSortingRepository<Person, String> {

  Flux<Person> findByFirstname(String firstname);

  Flux<Person> findByFirstname(Publisher<String> firstname);

  Mono<Person> findByFirstnameAndLastname(String firstname, String lastname);

  Flux<Person> findFirstByLastnameLike(String pattern);
}

Original pull request: #295.
2020-03-27 16:40:08 +01:00
Mark Paluch
b0348e272a #321 - Bind only bindable query method parameters.
We now only bind parameters to the query that are actually bindable instead of consuming the entire parameter list.
2020-03-19 10:12:45 +01:00
Jens Schauder
4a5184830d #189 - Polishing.
Refactored DefaultDatabaseClientUnitTests in order to make the relevant differences in setup easier to spot.

Original pull request: #308.
2020-03-17 11:34:05 +01:00
Jens Schauder
6a8ab608e5 #189 - Polishing.
Made assertions in tests more strict.

Original pull request: #308.
2020-03-17 11:33:59 +01:00
Mark Paluch
366c10be40 #189 - Accept StatementFilterFunction in DatabaseClient.
We now accept StatementFilterFunction and ExecuteFunction via DatabaseClient to filter Statement execution. StatementFilterFunctions can be used to pre-process the statement or post-process Result objects.

databaseClient.execute(…)
		.filter((s, next) -> next.execute(s.returnGeneratedValues("my_id")))
		.filter((s, next) -> next.execute(s.fetchSize(25)))

databaseClient.execute(…)
		.filter(s -> s.returnGeneratedValues("my_id"))
		.filter(s -> s.fetchSize(25))

Original pull request: #308.
2020-03-17 11:33:21 +01:00
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
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
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
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
f5b9d658d9 #296 - Rename DatabaseClient bean to r2dbcDatabaseClient. 2020-02-12 14:29: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