Commit Graph

1115 Commits

Author SHA1 Message Date
Mark Paluch
08cb9e848d Polishing.
Use ResolvableType for type assignability check when resolving Type from a KType.

See #2324.
2021-03-12 16:56:10 +01:00
Mark Paluch
0065c17cca Use primary copy method for Kotlin data classes.
We now resolve the copy method for Kotlin data classes that match the primary constructor. Previously, copy method resolution could find a secondary copy method as we didn't check for the primary constructor structure (parameter names and types).

Closes #2324.
2021-03-12 11:30:10 +01:00
Oliver Drotbohm
d03bfb877a Introduce PersistentEntity.doWithAll(…).
To let a PropertyHandler operate on all properties *and* the inverse property of associations.

Fixes #2325.
2021-03-11 10:38:44 +01:00
Oliver Drotbohm
6b0292cc66 Support for jMolecules' Association type.
We no recognize properties of type org.jmolecules.ddd.types.Association as associations in our PersistentProperty model.

Also, we now register JMolecules Converter implementations for Association and Identifier in CustomConversions so that they can persisted like their embedded primitive value out of the box.

Fixes #2315.
Original pull request: #2316.
2021-03-01 15:20:26 +01:00
Mark Paluch
3f1609587e Polishing.
Reformat code.

Original pull request: #2314.
Closes: #2313
2021-03-01 10:33:33 +01:00
Christoph Strobl
8917115ba9 Collect constructor type information via Constructor.getParameters().
This commit fixes an issue where we fail to detect all type arguments from a given constructor. calling getGenericParameterTypes in some cases does not include all Types, we now explicitly iterate over the parameters and extract the parameterized type that is used for creating the TypeInformation.

Closes: #2313
Original pull request: #2314.
2021-03-01 10:33:22 +01:00
Christoph Strobl
67ee745374 Use NativeDetector.inNativeImage() instead of manual property check.
Closes: #2298
Original pull request: #2299.
Relates to: spring-projects/spring-framework#25795
2021-02-17 09:14:02 +01:00
Christoph Strobl
b51bee7a0b Use contextual information when creating PersistentPropertyPaths.
In oder to preserve contextual information the PersistentPropertyPathFactory now obtains EntityInformation for properties from the MappingContext via their PersistentProperty representation instead of plain the TypeInformation as the former contains more information about the actual type and signatures.

Closes #2293.
Original pull request: #2294.
2021-02-16 10:50:16 +01:00
Mark Paluch
5d90fb9e6a Consider primary repository definition in Repositories when created Repositories using ApplicationContext.
Closes #1583.
Original pull request: #465.
2021-02-15 15:57:30 +01:00
Mark Paluch
7480fcf18a Improve guards to avoid potential ClassCastException.
We now guard Slice conversion against potential ClassCastException using the proper condition grouping. Previously, the conversion could happen if the query is a slice query while the source was not a Slice.

Resolves #2296.
2021-02-15 15:33:28 +01:00
Christoph Strobl
ee004b0f10 Rename DefaultQuerydslBinderCustomizer to QuerydslBinderCustomizerDefaults.
See #206.
Original Pull Request: #2292
2021-02-09 12:50:23 +01:00
Mark Paluch
4e07b85934 Add support for providing default Querydsl bindings.
We now consider default Querydsl bindings when registering a DefaultQuerydslBinderCustomizer bean. The default bindings are applied before applying type-specific bindings.

Closes #206.
Original Pull Request: #2292
2021-02-09 12:49:31 +01:00
Christoph Strobl
e3a8edf581 Avoid leaking data via Exception message.
Do not include the result value in the exception message to avoid data exposure.
Improve data flow to avoid superfluous null checks.

See #2290.
Original Pull Request: #2291.
2021-02-09 12:46:02 +01:00
Mark Paluch
cdeecd4a75 Throw UnsupportedOperationException when a projected value cannot be returned.
We now throw UnsupportedOperationException when a projected value cannot be returned because it cannot be brought into the target type, either via conversion or projection.

This exception improves the error message by avoiding throwing IllegalArgumentException: Projection type must be an interface from the last branch that falls back into projections.

Closes #2290.
Original Pull Request: #2291
2021-02-09 12:43:48 +01:00
Mark Paluch
ed34f2aef8 Add negative-caching in PreferredConstructor.isConstructorParameter(…).
We now cache the negative outcome of PreferredConstructor.isConstructorParameter(…) to avoid iterations and iterator allocations which roughly improves typical converter usage by roughly 32%.

Before:
Benchmark                                                               Mode  Cnt        Score        Error  Units
TypicalEntityReaderBenchmark.simpleEntityGeneratedConstructorAndField  thrpt   10  6848447,474 ± 554354,377  ops/s

After
Benchmark                                                               Mode  Cnt        Score         Error  Units
TypicalEntityReaderBenchmark.simpleEntityGeneratedConstructorAndField  thrpt   10  9071099,879 ± 1423166,087  ops/s

Closes #2295.
2021-02-09 11:44:16 +01:00
Mark Paluch
cd82d50355 Deprecate ChainedTransactionManager.
We recommend to not use ChainedTransactionManager as it emulates distributed transactions without providing consistency guarantees that can end up in partially committed transactions. To attach to commit/rollback operations we recommend registering TransactionSynchronization instead.

Closes #2232
Original Pull Request: #2286
2021-02-02 14:45:39 +01:00
Mark Paluch
130db32194 Polishing.
Introduce factory methods on Pageable, PageRequest, and QPageRequest to construct PageRequest objects. Replace builder with with…(…) methods.

Closes #322.
2021-01-28 15:47:52 +01:00
Anastasiia Smirnova
2db26d2765 Add PageRequest builder.
We now support PageRequest creation through PageRequest.ofSize(10).withPage(1).withSort(Direction.DESC, "foo"). Simplified Pageable instances can be created through Pageable.ofSize(10).withPage(1).

Closes #322.
2021-01-28 15:46:34 +01:00
Mark Paluch
d4b8e38622 Polishing.
Attach repository interface name to each repository init event.

Make spring.data.repository.postprocessors conditional to reduce the number of events. Append full fragment diagnostics.

Reorder methods, add author tag, reformat code.

Closes #2247.
Original pull request: #2273.
2021-01-28 15:04:23 +01:00
Christoph Strobl
7d7f62f703 Add repository initialization metrics.
This commit adds support for collecting data repository startup metric (repository scanning, repository initialization) using core framework ApplicationStartup and StartupStep.
Collected metrics can be stored with Java Flight Recorder when using a FlightRecorderApplicationStartup.

Closes #2247.
Original pull request: #2273.
2021-01-28 15:04:23 +01:00
Valeriy.Vyrva
b2fe6d3d22 Convert Vavr Seq to list with asJava method.
asJava(…) creates a read-only view instead of copying elements into a new List.

Closes #2217
Original pull request: #287
2021-01-26 10:38:52 +01:00
Oliver Drotbohm
1e13d40cbb Avoid pre-computing base URI in PagedResourceAssemblerArgumentResolver.
We now avoid the pre-computation of the base URI in PagedResourceAssemblerArgumentResolver as the actual assembler will fall back to using the URI of the current request by default anyway. The latter makes sure that request parameters, that are contained in the original requests appear in links created. If a controller wants to deviate from that behavior, they can create a dedicated link themselves and hand that to the assembler explicitly.

Fixes GH-2173, GH-452.
2021-01-26 10:00:52 +01:00
Mark Paluch
3d7cabf814 Guard potential null dereference in recursive initialization calls.
We now assign the repository field before resolving the persistent entity through the mapping context to avoid a potential NPE caused by a getObject(…) invocation through an application event.

Closes #2068
2021-01-26 09:47:37 +01:00
Mark Paluch
89c5b3839c Enable QuerydslPredicate for meta-annotation usage.
We now support composed annotations that are meta-annotated with QuerydslPredicate.

Resolves #2277.
2021-01-25 16:20:55 +01:00
Mark Paluch
d57fb3ea0e DATACMNS-1785 - Polishing.
Introduce constructors accepting non-null ConversionService, handle conversion service defaulting in configuration classes by using ObjectProvider. Extract common code to create a predicate in getPredicate(…) method. Add unit test.

Convert spaces to tabs.

Related ticket: #2200.
Original pull request: #2274.
2021-01-25 15:52:50 +01:00
Matías Hermosilla
a83969005b DATACMNS-1785 - Add ReactiveQuerydslPredicateArgumentResolver and ReactiveQuerydslWebConfiguration.
We now provide ReactiveQuerydslPredicateArgumentResolver to resolve Querydsl Predicates when using Spring WebFlux.

Related ticket: #2200.
Original pull request: #2274.
2021-01-25 15:52:30 +01:00
Mark Paluch
ce4558fc4b Fix constructor resolution for Kotlin classes using unsigned types.
We now leniently skip parameter name resolution for types using unsigned types. The issue is caused by Kotlin's DefaultConstructorMarker that doesn't report a parameter name.

Closes #2215
2021-01-18 13:46:31 +01:00
Jens Schauder
dc09d5d34d Add JSR310 converters to the converters used for projections.
Similar converters where removed because they clashed with the support for nullable wrappers. This adds them back as dedicated converters that does not clash with conversions for nullable wrappers.

See bd3992dfc5 (diff-96f7084777a2a702d85f5c600e542b10123d6c3332ed3d3f8e329ca7061faab0R55)

Original Pull Request: #479
Closes: #2223
2021-01-13 07:03:44 +01:00
Mark Paluch
efe93e31b1 Polishing.
Reuse definitive path flag without recompile the expression.

See #2270
2021-01-12 15:50:51 +01:00
Mark Paluch
037df8e3ae Correctly unwrap nested JSON array projections.
We now check for double-nesting of JSON path evaluation results when the return type is a collection. If the result is double-wrapped and the nested object is a collection then we unwrap it.

Closes #2270
2021-01-12 15:50:50 +01:00
Mark Paluch
8bd2f9bf34 Update copyright year to 2021.
Closes #2268.
2021-01-07 13:42:27 +01:00
Mark Paluch
71b92bc3f9 DATACMNS-1838 - Accept ExpressionDependencies in BasicPersistentEntity.getEvaluationContext(…).
Allow obtaining an EvaluationContext with a reduced set of extensions that are required for ExpressionDependencies instead of initializing all extensions.
2020-12-07 11:26:58 +01:00
Mark Paluch
6616f6e577 DATACMNS-1827 - Polishing.
Extract qualifier lookup into SpringDataAnnotationUtils.

Original pull request: #474.
2020-12-01 10:15:15 +01:00
Vedran Pavic
438b01e161 DATACMNS-1827 - Consider Qualifier meta-annotated Sort method parameters.
Original pull request: #474.
2020-12-01 10:15:08 +01:00
Mark Paluch
ae4f0361af DATACMNS-800 - Polishing.
Update RxJava 2/3 repositories with deleteAllById(…). Reorder methods.

Original pull request: #476.
2020-11-25 09:37:48 +01:00
Jens Schauder
bc76fcb7fc DATACMNS-800 - Adds deleteAllById to ReactiveCrudRepository and CrudRepository.
CrudRepository and ReactiveCrudRepository now expose a deleteAllById(Iterable<ID>) method to delete multiple entities by their Id.

Original pull request: #476.
2020-11-25 09:32:11 +01:00
Mark Paluch
cd482bf9e3 DATACMNS-1827 - Polishing.
Consider Qualifier meta-annotated Sort and Pageable method parameters. Add author tag.

Original pull request: #473.
2020-11-11 09:30:06 +01:00
Vedran Pavic
e758dd3a84 DATACMNS-1827 - Pageable and Sort arguments with empty qualifier value shouldn't be prefixed with delimiter.
Original pull request: #473.
2020-11-11 09:30:01 +01:00
Mark Paluch
1d146da048 DATACMNS-1828 - Revert custom collection component type lookup.
We now report the first generic parameter for collection-like types to use the behavior that was previously in place. We will address the issues resulting of the intent to report the correct component type of Iterable in a later change.
2020-11-06 16:08:06 +01:00
Oliver Drotbohm
9fddd402f7 DATACMNS-1828 - Fix Map component type lookup for custom Map implementations.
Instead of using the first generic type parameter of a parameterized type as Map component type, we now explicitly lookup the super type's Map-specific generics configuration and use its first generic type parameter. The same for collection like types falling back to the parameter type bound to Iterable.
2020-11-05 15:21:55 +01:00
Jens Schauder
6572880412 DATACMNS-1820 - Moves PageabeExecutionUtils to o.s.data.support.
This avoids module cycles when it is used from a template.
The old version is still there, deprecated and delegates to the new version.

Original pull request: #472.
2020-10-28 09:54:54 +01:00
Mark Paluch
0902fe8f8b DATACMNS-1819 - Use awaitSingleOrNull to bridge Publisher to Coroutines Repositories.
We're now awaiting completion of the underlying Publisher to ensure all completion tasks have finished before continuing with the execution. This is to avoid completion running in parallel to the actual coroutine as not awaiting completion can result in race conditions.
2020-10-27 16:43:29 +01:00
John Blum
2fbf709459 DATACMNS-1804 - Correct grammar in Exception messages thrown by Repository classes.
Original pull request: #467.
2020-10-23 17:03:36 +02:00
Oliver Drotbohm
e3e23828ef DATACMNS-1806 - Polishing.
Styilistic tweaks (we only qualify writing field access with this).

Original pull request: #468.
2020-09-25 16:42:41 +02:00
Henning Rohlfs
a442b90021 DATACMNS-1806 - Prevent returning null from Lazy due to concurrency problem.
When accessed concurrently from multiple threads, Lazy.getNullable() could return null unexpectedly.

Original pull request: #468.
2020-09-25 16:42:41 +02:00
Mark Paluch
d10560f238 DATACMNS-1762 - Reintroduce calls to ReactiveWrapperConverters.supports(…) after decoupling from QueryExecutionConverters.
We now consider reactive wrapper types in all areas that previously relied on QueryExecutionConverters to handle reactive type information correctly. Specifically, we call supports(…) and perform type unwrapping to ensure to detect the correct return type.
2020-09-25 16:25:43 +02:00
Oliver Drotbohm
af9dd6110d DATACMNS-1726 - Polishing of nullability after Lombok removal.
Reviewed visibility modifiers manually introduced constructors previously provided by Lombok. Also some nullability constraints have been accidentally changed by that.
2020-09-25 15:29:08 +02:00
Mark Paluch
5876bd2e5a DATACMNS-1762 - Consider reactive types as wrappers during method introspection.
We now perform type unwrapping and introspection for reactive types for method return types and method arguments after decoupling QueryExecutionConverters.supports(…) from ReactiveWrapperConverters.
2020-09-25 14:41:54 +02:00
Christoph Strobl
f261220372 DATACMNS-1762 - Polishing.
Update JavaDoc, remove unused imports and reduce method visibility.

Original Pull Request: #459
2020-09-25 08:00:29 +02:00
Wim Deblauwe
97df0fa899 DATACMNS-1762 - Add tests for projections returning Optional.
Original Pull Request: #459
2020-09-25 08:00:08 +02:00