Commit Graph

1537 Commits

Author SHA1 Message Date
Mark Paluch
a0f67c1909 DATACMNS-1156 - Prepare next development iteration. 2017-10-02 11:37:21 +02:00
Mark Paluch
dc85837958 DATACMNS-1156 - Release version 2.0 GA (Kay). 2017-10-02 11:10:22 +02:00
Mark Paluch
497edfeefb DATACMNS-1156 - Prepare 2.0 GA (Kay). 2017-10-02 11:09:17 +02:00
Mark Paluch
96d0a12e5a DATACMNS-1156 - Updated changelog. 2017-10-02 11:09:08 +02:00
Mark Paluch
11458c9dcf DATACMNS-1181 - Polishing.
Use Spring Framework's Nullable annotation instead the JSR-305 one.

Original pull request: #251.
2017-10-02 10:41:30 +02:00
Mark Paluch
b18989786f DATACMNS-1181 - Adapt MethodHandle lookup of default methods in package-scoped interfaces to changes in Java 9.
We now attempt MethodHandle lookup with deep reflection capabilities via MethodHandles.privateLookupIn(…) to properly resolve default interface methods on interfaces with package-protected visibility. This API is only available in Java 9 so we need to rely on reflection.

Original pull request: #251.
2017-10-02 10:41:17 +02:00
Mark Paluch
fc02b4fd08 DATACMNS-1184 - Fix Javadoc for non-null parameters in QuerydslPredicateExecutor.
Align Javadoc to reflect the non-null contract for Predicate arguments.

Mention unpaged/unsorted factory methods for Pageable/Sort arguments.

Related ticket: DATACMNS-1114.
2017-10-02 10:04:42 +02:00
Oliver Gierke
8da9679fc1 DATACMNS-1172 - Removed ability to use scanning all packages for repository implementations again.
Kept in a separate commit, so that it's easy to add again by reverting this commit. Removed, as the new behavior is effectively what had been documented as intended behavior all the time.

Original pull request: #248.
2017-09-27 16:09:12 +02:00
Oliver Gierke
da88163141 DATACMNS-1172 - Extracted fragment setup into value object.
We now use FragmentMetadata to control the way fragement interfaces and base packages to scan are calculated. Refactored RepositoryConfiguration.getImplementationBasePackages() to not take a parameter.

Original pull request: #248.
2017-09-27 16:09:11 +02:00
Mark Paluch
3bae636e2f DATACMNS-1172 - Limit repository custom implementation scanning by default to repository interface packages.
Custom repository implementation scan defaults to the repository interface package and its subpackages and no longer scans all configured base packages. Scan for fragment implementations defaults to the fragment interface package. Using the interface package for scanning aligns the behavior with the documentation.

This default can be changed with @Enable…Repositories annotations that support the limitImplementationBasePackages parameter to scan in repository base packages for custom implementations:

@EnableJpaRepositories(limitImplementationBasePackages = false)
@Configuration
class AppConfiguration {
  // …
}

Declaring the implementation along with the interface in the same package is an established design pattern allowing to limit the scanning scope. A limited scope improves scanning performance as it can skip elements on the classpath, that do not provide that particular package.

Previously, we scanned for implementations using the configured base packages that were also used to discover repository interfaces. These base packages can be broader for applications that spread repository interfaces across multiple packages.
2017-09-27 16:09:11 +02:00
Mark Paluch
2220bed116 DATACMNS-1179 - Adapt to changed Spring Framework 5 documentation structure.
Update links in the reference docs to their new locations.
2017-09-27 12:19:47 +02:00
Jens Schauder
90448bdea6 DATACMNS-1177 - Polishing.
Removed redundant static keywords on inner enums.

Original pull request: #250.
2017-09-27 11:41:09 +02:00
Oliver Gierke
aa7dde94d4 DATACMNS-1177 - Polishing.
Formatting. JavaDoc.

Original pull request: #250.
2017-09-27 11:41:09 +02:00
Jens Schauder
79709629ef DATACMNS-1177 - Parameter.isDynamicProjectionParameter() now uses unwrapped type instead of actual type.
When trying to determine if a parameter is a dynamic projection parameter, i.e. the parameter of type Class that determines the projection to use, now the type parameter of that method parameter gets compared with the unwrapped return type. Therefore this works now not only for Maps and Collections but also for the various wrappers defined in QueryExecutionConverters.

Moved the method for unwrapping the return type from AbstractRepositoryMetadata to QueryExecutionConverters in order to make it available to every class needing it. This also puts it closer to the data it is working on.

Original pull request: #250.
2017-09-27 11:40:55 +02:00
Mark Paluch
2b4ef1a555 DATACMNS-1175 - Remove argument array caching from EntityInstantiators.
We no longer cache argument arrays in our EntityInstantiators to prevent changes to shared mutable state caused by reentrant calls.

Previously, a re-entrant call requesting an argument array of the same size as a previous call in the call stack reused the same array instance. Changes to this shared mutable state by multiple invocations caused an invalid state rendering wrong parameters for object instantiation. Removing the caching and only reusing an empty array for zero-arg constructors is the only safe approach for now.

Re-instantiation of object allocations results in a higher GC pressure but guarantee side effect-free instantiation and should be on-par with previous versions performance profile.

Original pull request: #247.
2017-09-27 10:55:34 +02:00
Mark Paluch
cc0ab54c38 DATACMNS-1171 - Do not create PersistentEntity for unsupported Kotlin classes.
We now reject unsupported Kotlin classes from the MappingContext by default by not creating persistent entities.

Original pull request: #245.
2017-09-25 12:23:35 +02:00
Mark Paluch
d9d0d594e5 DATACMNS-1171 - Limit Kotlin reflection support to regular classes.
We now only inspect regular Kotlin classes with inspection to adapt Kotlin-specific behavior. Multipart-, synthetic and unknown classes are not supported. In such cases we fall back to the JVM reflection mechanism.

Non-regular classes are typically synthetic stubs, lambdas and SAM conversion which do not represent typical domain objects but rather technical bridge code.

Original pull request: #245.
2017-09-25 12:23:30 +02:00
Oliver Gierke
65e21344ac DATACMNS-1173 - Fixed value lookup of AnnotationRevisionMetadata.
Fixed handling of absent values. Minor refactorings. More unit tests.
2017-09-25 09:56:31 +02:00
Mark Paluch
041c18bef9 DATACMNS-1170 - Fallback to default constructor discovery for Kotlin classes without primary constructor.
We now fall back to default preferred constructor discovery if a Kotlin class has no primary constructor and no preferred constructor is resolved. Previously, primary constructor resolution yielded no result (returned null) which caused the subsequent Java constructor lookup to fail.

Original pull request: #244.
2017-09-22 12:11:04 +02:00
Mark Paluch
93c65c02fe DATACMNS-1159 - Downgrade to CDI 1.0.
We now build against CDI 1.0 again while using CDI 2.0 for testing.
2017-09-22 11:47:11 +02:00
Oliver Gierke
d9860f2d20 DATACMNS-1161 - Polishing.
Typo in JavaDoc.

Original pull request: #243.
2017-09-21 18:14:57 +02:00
Jens Schauder
ea03388a7c DATACMNS-1161 - Renamed PersistentProperty.getPersitentEntityType(…) to ….getPersitentEntityTypes(…).
The new name currently delegates to old version, so classes only implementing the old method still work. Old name is deprecated.

Original pull request: #243.
2017-09-21 17:46:28 +02:00
Oliver Gierke
404610ebb4 DATACMNS-1168 - QuerydslPredicateBuilder now returns empty predicate by default. 2017-09-21 16:23:40 +02:00
Oliver Gierke
7987896098 DATACMNS-1167 - Added explicit automatic module name for JDK 9. 2017-09-21 11:58:18 +02:00
Oliver Gierke
a15c82c414 DATACMNS-1157 - Polishing.
Tiny formatting fixes in the reference documentation.

Original pull request: #241.
2017-09-21 10:24:01 +02:00
Mark Paluch
b992c38256 DATACMNS-1157 - Polishing.
Fix typo in reference to AfterDomainEventPublication.

Original pull request: #241.
2017-09-21 10:23:54 +02:00
Mark Paluch
fcf97e1e71 DATACMNS-1157 - Enforce nullable/non-null API constraints on repository query methods.
We now validate query method invocations to check method parameters whether they accept null values and reject execution if null values are not supported. We derive nullability support from repository interfaces declared using Kotlin and Spring's NonNullApi/Nullable annotations.

We also check whether a query method can return null. If a query method returns null which isn't supposed to do so, then we throw EmptyResultDataAccessException to prevent null return values.

interface UserRepository extends Repository<User, String> {

  List<User> findByLastname(@Nullable String firstname);

  @Nullable
  User findByFirstnameAndLastname(String firstname, String lastname);
}

interface UserRepository : Repository<User, String> {

  fun findByLastname(username: String?): List<User>

  fun findByFirstnameAndLastname(firstname: String, lastname: String): User?
}

Original pull request: #241.
2017-09-21 10:23:47 +02:00
Oliver Gierke
2c20377cfa DATACMNS-1166 - Upgrade to Vavr 0.9.1. 2017-09-21 09:25:11 +02:00
Oliver Gierke
e7ae4a8bb8 DATACMNS-1165 - Added support for Streamable as repository return type.
We now allow users to use our own Streamable interface as query method return types to easily invoke ….stream() on everything that returns an Iterable using non-parallel streaming by default.
2017-09-20 16:31:29 +02:00
Oliver Gierke
1a199847cd DATACMNS-1162 - Improved support for immutable aggregates.
AbstractAggregateRoot is now generified to be able to use its concrete type on methods returning an instance of itself. Added new methods andEvent(…) and andEventsFrom(…) to easily transfer events from another aggregate instance. Added unit tests for fundamental functionality of the base class.
2017-09-20 11:45:37 +02:00
Oliver Gierke
72b927ea2c DATACMNS-1163 - EventPublishingInterceptor now prefers arguments over return values for event publication.
We now prefer to inspect the arguments handed to save(…) methods over inspecting the return value as the invocation of the actual method is free to exchange the instance handed into it and return a completely new one with the events contained in the parameter completely wiped.
2017-09-20 11:09:25 +02:00
Mark Paluch
a8cc4783bf DATACMNS-1159 - Upgrade to OpenWebBeans 2.0.1. 2017-09-18 15:05:47 +02:00
Oliver Gierke
687d7449be DATACMNS-1130 - After release cleanups. 2017-09-11 17:40:20 +02:00
Oliver Gierke
0966e3f476 DATACMNS-1130 - Prepare next development iteration. 2017-09-11 17:40:18 +02:00
Oliver Gierke
2d70e2843e DATACMNS-1130 - Release version 2.0 RC3 (Kay). 2017-09-11 17:24:44 +02:00
Oliver Gierke
a56e88d095 DATACMNS-1130 - Prepare 2.0 RC3 (Kay). 2017-09-11 17:23:51 +02:00
Oliver Gierke
09208814da DATACMNS-1130 - Updated changelog. 2017-09-11 17:23:37 +02:00
Mark Paluch
4c66061b61 DATACMNS-1131 - Updated changelog. 2017-09-11 12:43:46 +02:00
Oliver Gierke
cdc6201fce DATACMNS-1011 - Rewrote chapter on repository projections. 2017-09-08 15:45:19 +02:00
Johnny Lim
fb19d84c75 DATACMNS-1153 - Removed unreachable assertion in XmlRepositoryConfigurationSource.
Original pull request: #236.
2017-09-07 15:22:35 +02:00
Oliver Gierke
2cfd6b8966 DATACMNS-1152 - Setup of ProjectingJackson2HttpMessageConverter now tries to use unique ObjectMapper from ApplicationContext.
We're now trying to look up a uniquely available ObjectMapper instance from the application context falling back to a simple new instance in case none can be found.
2017-09-06 17:11:51 +02:00
Oliver Gierke
4b323eca11 DATACMNS-1150 - Projection methods with SpEL expressions can now use method parameters.
We now forward method parameters of methods on projection interfaces to the expression evaluation. The parameters are exposed via an array named "args".
2017-09-04 19:15:04 +02:00
Mark Paluch
c091d4db56 DATACMNS-1148 - Return primitive boolean in PartTree.isExistsProjection(…).
Declare primitive return type to avoid nullable return values.
2017-08-28 15:52:26 +02:00
Mark Paluch
67f52d5d70 DATACMNS-1141 - Polishing.
Remove superfluous null checks in places where state cannot be null. Add nullable annotations to nullable variables. Remove whitespaces.
2017-08-28 15:52:25 +02:00
Christoph Strobl
0669632a61 DATACMNS-1141 - Add missing NonNullApi and Nullable annotations. 2017-08-28 13:32:47 +02:00
Mark Paluch
1e134cbd33 DATACMNS-1141 - Fix line endings. 2017-08-28 13:32:47 +02:00
Mark Paluch
3a2b6b601b DATACMNS-1141 - Add missing NonNullApi and Nullable annotations.
Add Nullable annotation to ParsingUtils, Sort.Order and PropertyValueProvider.

Add getRequiredAnnotation(…) to PersistentEntity and PersistentProperty to provide methods returning required, non-null annotations.
2017-08-28 13:32:15 +02:00
Mark Paluch
d657b17e74 DATACMNS-1147 - Do not consider @NoRepositoryBean interfaces as fragment interfaces.
We filter interfaces annotated with @NoRepositoryBean from fragment interface candidates and not longer scan for implementations of these.

Extending a base repository usually requires an interface which is used as base interface instead of Repository/CrudRepository in user repositories. If the naming scheme of the extended interface and the implementation fits to fragment interfaces, then we previously registered the class additionally as fragment implementation. The bean registration caused container startup failures because of unsatisfied dependencies or would shadow the base repository implementation.

Original pull request #239.
2017-08-28 12:54:17 +02:00
Oliver Gierke
22b6971318 DATACMNS-1126 - Polishing.
Moved PreferredConstructorDiscoverers into PreferredConstructorDiscoverer to hide more API. Renamed ClassGeneratingKotlinEntityInstantiator to KotlinClassGeneratingEntityInstantiator.

Use org.springframework.util.Assert instead of com.mysema.commons.lang.Assert.

Original pull request: #233.
2017-08-25 15:00:45 +02:00
Mark Paluch
b05c4e74fb DATACMNS-1126 - Polishing.
Trailing whitespace in ReflectionUtils.

Original pull request: #233.
2017-08-25 13:04:28 +02:00