Commit Graph

1288 Commits

Author SHA1 Message Date
Jens Schauder
6cf2634a64 Fixed dependency cycle.
Closes #2514
2021-12-14 15:06:14 +01:00
Christoph Strobl
ecec2e5666 Polishing.
Replace boolean flag with enum, assert open vs. closed projection and update javadoc.

Original Pull Request: #2420
2021-12-13 13:03:18 +01:00
Mark Paluch
a63774e6ec Add support for properties using deep map-in-map/list-in-map nesting.
Original Pull Request: #2420
2021-12-13 13:02:52 +01:00
Mark Paluch
0744580766 Move EntityProjection from inner class to top-level class.
Original Pull Request: #2420
2021-12-13 13:02:25 +01:00
Mark Paluch
0c80e9fa46 Add Predicates utility.
Original Pull Request: #2420
2021-12-13 13:02:01 +01:00
Mark Paluch
b189240aaf Polishing.
Original Pull Request: #2420
2021-12-13 13:01:27 +01:00
Mark Paluch
caa8c6afc5 Refactor PropertyFilterSupport into EntityProjectionIntrospector.
Original Pull Request: #2420
2021-12-13 13:00:59 +01:00
Mark Paluch
9948fefe69 Provide class for inspecting nested projections.
Original Pull Request: #2420
2021-12-13 13:00:20 +01:00
heowc
8969a55c27 Add @Nullable to ParametersParameterAccessor.getValue().
Add missing Override and Nullable annotations. Update Javadoc to mention correct return value.

Closes #2506
2021-12-13 10:53:59 +01:00
Mark Paluch
ea335f06ef Polishing.
Add missing override annotations.

See #2508
2021-12-09 11:18:51 +01:00
Mark Paluch
6a52f274f6 Introduce configuration of class loader in SimpleTypeInformationMapper.
We now support configuration of the class loader in SimpleTypeInformationMapper to use a configured class loader instead of falling always back to the default/contextual class loader. In arrangements where the contextual class loader isn't able to provide access to the desired classes (e.g. parallel Streams, general Fork/Join Thread usage) the contextual class loader may not have access to the entity types. By implementing BeanClassLoaderAware, we can now propagate a configured class loader.

Closes #2508
2021-12-09 11:17:46 +01:00
Mark Paluch
ef522f8e9c Polishing.
Extract duplicate calls to findAnnotation(…) into static helper methods.

See #2500
2021-12-08 14:04:36 +01:00
XenoAmess
ca723d11c7 Use AnnotationUtils.findAnnotation(…) instead of AnnotatedElement.isAnnotationPresent(…).
Enable use of meta annotations by leveraging MergedAnnotations.

Closes #2500
2021-12-08 10:15:06 +01:00
Mark Paluch
8bd81a796d Fix argument expansion in RepositoryFactorySupport logging.
Closes #2502
2021-12-07 09:32:51 +01:00
Mark Paluch
788457c901 Migrate off SLF4J to Spring JCL.
Closes #2496
2021-11-16 10:48:56 +01:00
Mark Paluch
55b83dfa83 Refine documentation for PageableExecutionUtils.
Closes #2492
2021-11-09 14:48:42 +01:00
Oliver Drotbohm
c866b42025 Polishing.
A few further tweaks: ClassTypeInformation now never unwraps the user type to consistently work with the type originally presented in the lookup. That allows us to get rid of the custom equals(…)/hashCode() methods and removes the need to deal with original and user type in the same CTI instance.

The augmented caching of PersistentEntities in AbstractMappingContext now primarily happens in doAddPersistentEntity(…). We still need to implement a cache manipulation for the case that a user type has caused the creation of a PersistentEntity first and we see a lookup for the proxy type later. Before actually processing the TypeInformation we now try to lookup an already existing PersistentEntity for the user type and augment the cache if one was found.

See #2485
Original pull request: #2486.
2021-10-27 12:19:15 +02:00
Mark Paluch
ac9d11638c Polishing.
Remove isProxyTypeInformation from TypeInformation. Use computeIfAbsent to fall back to user type information when attempting to add a entity to the MappingContext.

See #2485
Original pull request: #2486.
2021-10-27 09:19:36 +02:00
Christoph Strobl
c30f3fc8af Create PersistentEntities only for user class in case of proxy instance.
This commit makes sure to only create a PersistentEntity for an actual user type. Therefore ClassTypeInformation now considers the given type and not only the user one for both equals and hashcode. This makes sure we can distinguish TypeInformation for a proxy from the one of a user class.
The AbstractMapping context will take care of unpacking proxied types and registering the created entity for both the user as well as the proxy type information.
Prior to this commit build time generated proxy instances would have been able to pollute the context depending on the order they had been served by the initial entity set.

Closes #2485
Original pull request: #2486.
2021-10-27 09:19:36 +02:00
Mark Paluch
69397a11b2 Polishing.
Reduce test element visibility, remove unused constant.

See #2472
2021-10-19 14:31:20 +02:00
Mark Paluch
7c1886201c Consider nested property paths containing a number.
PropertyPath now considers nested property paths (userLastname2 -> user.lastname2) that contain or end with a number.

Closes #2472
2021-10-19 14:31:20 +02:00
alikilickaya
dd8a8083a5 Fix Javadoc in QueryByExampleExecutor.
Closes #2480
2021-10-13 14:16:35 +02:00
Pavel Gnusin
c383024312 Look up bean merged bean definitions in Repositories.
We now look up bean definitions for repositories using BeanFactory.getMergedBeanDefinition(…) to consider parent-child relationships across application contexts.

As we iterate through bean definitions considering ancestors we need to allow parent bean definitions. Previously, we obtained the bean definition from the child context and since the bean was inherited from the parent, the child context cannot provide a bean definition.

Closes #2383
Original pull request: #2384.
2021-10-12 09:38:54 +02:00
Mark Paluch
4e528a590a Allow reuse of ProjectionFactory from RepositoryFactorySupport.
Closes #2441
2021-10-11 11:06:52 +02:00
Mark Paluch
511181193e Add FluentQuery support to QueryByExampleExecutor and ReactiveQueryByExampleExecutor.
FluentQuery allows extending a query specification initially defined by a Example probe or a Querydsl Predicate and fetching the actual result through a functional programming model:

interface PersonRepository extends QuerydslPredicateExecutor<Person> {
  <S extends T, R> R findBy(Predicate predicate, Function<FluentQuery.FetchableFluentQuery<S>, R> queryFunction);
}

PersonRepository repo = …;

List<PersonProjection> result = repo.findBy(QPerson.person.name.eq("Walter"), q -> q.sort(Sort.by("lastname")).as(PersonProjection.class).all());

Closes: #2228
Original pull request: #2421.
2021-10-08 09:17:38 +02:00
Mark Paluch
f1f08933da Polishing.
Add since and author tags. Add ticket references to tests. Reformat code.

See #2471
2021-10-06 10:13:00 +02:00
hantsy
d18275770c Add Smallrye Mutiny support.
Closes #2471
2021-10-06 09:55:20 +02:00
Mark Paluch
82fd3cac27 Deprecate support for RxJava 2.
Closes #2470
2021-09-27 14:04:36 +02:00
Mark Paluch
9fbf39154f Fix Javadoc.
Fix invalid links. Replace Javadoc links to JSR-305 with code annotations.

Replace self-enclosing tags with simple ones.

See #2423
2021-09-21 11:11:30 +02:00
Mark Paluch
bb3898add3 Consider property path root in QuerydslBindings.
We now consider a qualified property path when registering and querying `QuerydslBindings` to ensure that paths matching various domain types do not accidentally get applied for a different type than they were registered for.
Previously, a binding for `Address.description` would be also applied to `User.description` as only the property path `description` was considered when looking up bindings.

Closes: #2418
Original Pull Request: #2422
2021-09-14 16:06:12 +02:00
Mark Paluch
27d4918ad5 Publish delete events by repository methods deleteInBatch and deleteAllInBatch methods.
We now publish events from deleteInBatch and deleteAllInBatch methods to consider well-known repository methods.
We also now prevent event publication if the method argument is not an instance of the domain type.

Closes: #2448.
2021-09-14 10:08:54 +02:00
Mark Paluch
f4805503c8 Reuse generated entity instantiators from ClassGeneratingEntityInstantiator instances.
We now reuse generated ObjectInstantiator classes instead of attempting to redefine classes with the same name. Redefinition leads to LinkageError and thus to the use of reflection-based instantiators and an increased allocation rate due to the failed attempt of class redeclaration.

Closes: #2446.
2021-09-09 15:18:30 +02:00
Mark Paluch
242a71ca56 Avoid Iterator allocations when calling Sort.isSorted().
Closes #2445
2021-09-07 16:07:24 +02:00
Oliver Drotbohm
c7c2df6cd9 Support for jMolecules' @Identity annotation.
Fixes #2438
Original pull request: #2439.
2021-09-07 09:12:51 +02:00
Oliver Drotbohm
3c887f6319 Avoid reflection in SpringDataWebConfiguration.
We now use an explicit lookup via the application context to consume PageableHandlerMethodArgumentResolverCustomizer and SortHandlerMethodArgumentResolverCustomizer rather than autowiring those into a field.

Fixes #2440.
2021-08-26 16:13:44 +02:00
Oliver Drotbohm
fbe513446d StreamUtils.zip(…) now treats infinite streams correctly.
When an infinite Stream was handed into StreamUtils.zip(…) as first argument, the resulting stream was infinite, too, while inverting the argument order was limiting the resulting stream to the length of the finite one. This is now fixed by actually evaluating whether we can advance on both of the streams and shortcutting the process if that is not possible on either of the streams, limiting the processing of the overall Stream to the shorter of the two as already advertised in the Javadoc.

Fixes #2426.
2021-08-09 17:06:56 +02:00
Mark Paluch
5fd8687506 Polishing.
Extract adding the actual entity to the MappingContext into its own method along with error handling spanning the entire entity initialization process.

See #2329
Original pull request: #2367.
2021-07-20 10:17:22 +02:00
Greg L. Turnquist
2511b1f1d6 Remove PersistentEntity from MappingContext upon mapping metadata initialization errors.
When an error happens inside the AbstractMappingContext, the caching sometimes gets corrupted. That's because some exceptions are caught, others are not. Instead, the error handling that clears out the cache needs to be shifted up one level, resulting in a simpler code block.

Closes #2329
Original pull request: #2367.
2021-07-20 10:16:30 +02:00
Mark Paluch
db8431ee41 Polishing.
Un-deprecate constructor. Rearrange method arguments to match parameter significance. Reformat code, replace space indents with tabs.

Original pull request: #2403.
2021-07-13 14:13:44 +02:00
sokomishalov
f91901387f Accept JsonProvider upon JsonProjectingMethodInterceptorFactory creation.
We now configure explicitly the JsonProvider that is used by JSONPath through JsonProjectingMethodInterceptorFactory to avoid misconfiguration due to JSONPath defaulting attempts. Accepting JsonProvider allows for improved flexibility during configuration.

Closes #2403
2021-07-13 14:11:48 +02:00
Mark Paluch
9ca1c7e157 Refine ClassGeneratingEntityInstantiator deprecation note.
Closes #2400
2021-07-13 10:35:16 +02:00
Christoph Strobl
b3ae0f7b0b Polishing.
Update documentation to match method signature.

Original Pull Request: #2410
2021-07-13 07:51:06 +02:00
Oliver Drotbohm
d3cd1ab60a Persistent entity type detection now starts with the association target type if available.
This causes us to inspect the most concrete type we can find from a property declaration that might be overridden using an annotation.

Closes: #2409
Original Pull Request: #2410
2021-07-13 07:48:28 +02:00
Oliver Drotbohm
e565c11dcc Consolidate names of methods that provide access to TypeInformation and Class on PersistentProperty.
We now name methods returning a TypeInformation<?> …TypeInformation() and ones that return Class<?> …Type(). In case of both flavors provided, overloads should move to the TypeInformation-based variant as the other one simply resolves ….getType() on the returned value.

Closes: #2408
Original Pull Request: #2410
2021-07-13 07:47:53 +02:00
David Becker
95e115b357 Fix EvaluationContextExtension filter fall-through in ReactiveExtensionAwareEvaluationContextProvider.
Using JpaEvaluationContextExtension with reactive infrastructure in place, ReactiveExtensionAwareEvaluationContextProvider can lead to IllegalStateException if the desired extension doesn't match the predicate instead of being silently dropped.

Closes #2392
Original pull request: #2393.
2021-07-12 15:47:43 +02:00
Stephane Nicoll
8262e21c1a Polishing.
A public bean method that returns a private type is unusual and prevents the processing of such bean in reflection-free use cases. There was also an unnecessary qualifier in the implementation.

Closes #2399
2021-07-12 15:18:35 +02:00
Oliver Drotbohm
b3b590dcf0 Unify entity type detection.
Unified the calculations made for entityTypeInformation and entityTypes in AbstractPersistentProperty. This avoids both calculations getting out of sync. Also we avoid premature calculation abortions if SimpleTypeHolder.isSimpleType(…) returns true for the raw property type. The latter has caused issues for collection properties in Spring Data KeyValue which considers everything in java.util a simple type.

Related ticket: #2390.
2021-07-09 11:10:34 +02:00
Mark Paluch
ab74551928 Polishing.
Reduce TypeDiscoverer.isNullableWrapper method visibility to private to avoid exposure in preparation for wider value type support.

Original pull request: #2394.
See #2390.
2021-07-08 11:49:56 +02:00
Christoph Strobl
3277467b74 Resolve all persistent entities for a persistent property.
Original pull request: #2394.
Closes #2390.
2021-07-08 11:49:36 +02:00
Christoph Strobl
1f77786d89 Don't create PersistentEntity for Nullable wrapper type.
Original pull request: #2394.
Closes #2390.
2021-07-08 11:49:25 +02:00