Commit Graph

1615 Commits

Author SHA1 Message Date
Mark Paluch
8906e0dfad Prepare 2.5 RC1 (2021.0.0).
See #2303
2021-03-31 17:04:34 +02:00
Mark Paluch
905bdc97f0 Updated changelog.
See #2303
2021-03-31 17:04:30 +02:00
Oliver Drotbohm
23ebf3164f Support for association target type detection for jMolecules.
We now detect the component type of jMolecules' Association as association target type in AbstractPersistentProperty. AnnotationBasedPersistentProperty keeps the lookup of the explicit @Reference around but falls back to the Association analysis for that.

@Reference is now only considered by AnnotationBasedPersistentProperty. It was previously also (erroneously) considered by AbstractPersistentProperty.

It was also changed to return `null` in case no association target type could be looked up instead of returning the sole property's type in case that is an entity. This was done to satisfy the behavior documented on the interface but also to avoid the call to isEntity() during the calculation which might use association information in turn and thus lead to a stack overflow. Reworded the contract of PersistentProperty.getAssociationTargetType() to emphasize the symmetry with ….isAssociation() in implementation classes.

Closes: #2344.
2021-03-31 15:07:25 +02:00
Christoph Strobl
85c0ce1450 Polishing.
Original Pull Request: #2333
2021-03-30 12:06:58 +02:00
Mark Paluch
79ed0a75c7 Support @Value meta-annotations and expose MergedAnnotations on PreferredConstructor parameters.
We now support composed annotation that are annotated with `@Value`. we also expose MergedAnnotations through PreferredConstructor.Parameter for further use by store modules that want to inspect constructor argument annotations.

Closes: #2332
Original Pull Request: #2333
2021-03-30 12:06:03 +02:00
Mark Paluch
9224710c53 Unify return types in PageRequest.
first() and next() now retain PageRequest as return type to preserve the richer return type.

Closes #2318
2021-03-30 11:33:36 +02:00
Mark Paluch
e47faf8aa2 Improve error message if store module doesn't support a well-known fragment interface.
We now throw a RepositoryCreationException (or subclass) when a repository cannot be created due to a missing fragment, a fragment without implementation or if a well-known fragment is not supported by the repository factory.

Throw QueryCreationException if QueryExecutorMethodInterceptor cannot resolve a RepositoryQuery.

Closes #2341
Original pull request: #2342.
2021-03-29 11:14:20 +02:00
Mark Paluch
1abd534ab0 Document effect of using AccessType(PROPERTY) in combination with Persistable.
Closes #2338
Original pull request #2339
2021-03-25 11:38:49 +01:00
Mark Paluch
1eeef23fd9 Fix Kotlin copy method assignability check.
We now resolve only the raw class when checking if a primary constructor argument is assignable to method parameters of the synthetic copy method.
Previously we used ResolvableType's assignability check which considered generic type arguments. As the type resolution between the KType and copy method type is not symmetric, the check only succeeded in cases where both types could be resolved to the same type/assignable type. Using projections or Any caused asymmetric resolution and therefor the assignability check returned non-assignable.

Closes #2336.
2021-03-22 10:06:08 +01:00
Mark Paluch
cd9bf64f74 Prepare 2.5 M5 (2021.0.0).
See #2326
2021-03-17 11:17:26 +01:00
Mark Paluch
d5d8fcb9e4 Updated changelog.
See #2326
2021-03-17 11:17:19 +01:00
Mark Paluch
ac0bb5003b Updated changelog.
See #2305
2021-03-17 11:03:38 +01:00
Mark Paluch
0e9edff5b5 Updated changelog.
See #2301
2021-03-17 10:35:11 +01:00
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
524a33af7c Polishing.
Reduce test method visibility.

See #2324.
2021-03-12 11:30: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
Mark Paluch
f3dfd0b52c Document primitive type properties when using Query by Example.
Closes #2308.
2021-03-01 10:27:48 +01:00
Christoph Strobl
89649d6b1a Prepare 2.5 M4 (2021.0.0).
See #2304
2021-02-18 11:24:46 +01:00
Christoph Strobl
9bc1ffb8c0 Updated changelog.
See #2304
2021-02-18 11:24:41 +01:00
Christoph Strobl
b32d8097a0 Updated changelog.
See #2302
2021-02-18 11:18:24 +01:00
Christoph Strobl
1ccd4cbb56 Prepare 2.5 M3 (2021.0.0).
See #2272
2021-02-17 13:59:43 +01:00
Christoph Strobl
5405879688 Updated changelog.
See #2272
2021-02-17 13:59:34 +01:00
Christoph Strobl
84ddf33175 Updated changelog.
See #2271
2021-02-17 13:49:15 +01:00
Christoph Strobl
c0b70bcbc6 Updated changelog.
See #2257
2021-02-17 11:34:20 +01:00
Christoph Strobl
3b8b4c1674 Updated changelog.
See #2255
2021-02-17 10:58:19 +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
Jan Zeppenfeld
54f2d150c5 Add test for Repositories verifying isPrimary flag.
See #1583.
Original pull request: #465.
2021-02-15 15:58:39 +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
5e702a8c8a Polishing.
Slightly tweak wording.

See #2283
Original pull request: #2285
2021-02-09 11:53:32 +01:00
Christoph Strobl
5a1a7ff428 Update auditing documentation.
Mention that even when only using the CreatedDate & LastModifiedDate annotations it is mandatory to enable auditing.
Add sample of using auditing metadata within an embedded entity.

Closes #2283
Original pull request: #2285
2021-02-09 11:53:19 +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
fe5a8f4813 Polishing.
Remove outdated section.

See #2288
2021-02-02 14:41:09 +01:00
Christoph Strobl
b873d88b48 Document SpringDataJacksonModules in web support section.
Closes #2288
Original pull request: #2289.
2021-02-02 14:39:23 +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
Oliver Drotbohm
584464807e Upgrade to Servlet 4.0 to align with Spring Framework.
Also, tweak test case to avoid to refer to a field in a Spring class but rather use API to access the value. Changes in Spring Framework 5.3.4 require this as the internal structure of AbstractJackson2HttpMessageConverter changed to support custom ObjectMapper instances per type and media type.

Fixes GH-2284.
2021-01-26 23:00:51 +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