Support for considering nested repository interfaces can now be configured on the EnableJpaRepositories annotation via the considerNestedRepositories property. Previously nested repository definitions were ignored by the repositories infrastructure. This depends on DATACMNS-90.
Original pull request: #46.
Added a getOne(ID id) method to both JpaRepository as well as SimpleJpaRepository to be able to obtain references to entities (as implemented by EntityManager.getReference(…)).
So far, ClasspathScanningPersistenceUnitPostProcessor threw an IndexOutOfBoundsException on Windows as the OS-specific file separator doesn't match the forward slash used in the URI. This is fixed by modified scanForMappingFileLocations() to use '/' to build up the resource path.
Original pull request: #44.
Extracted the functionality specific to the handling of native queries out of SimpleJpaQuery and moved that to the new NativeJpaQuery type. Moved common functionality to AbstractStringBasedJpaQuery and used that as a new base class for SimpleJpaQuery and NativeJpaQuery. Introduced JpqQueryFactory to centralize construction of JpaQuery objects. Renamed getQuery() method in StringQuery to getQueryString().
Original pull request: #36.
When building Expression instances for attribute traversals we now inspect the mapping annotation to detect non-optional associations and prevent an extra left join from being created. This is because the join is only necessary to not drop null values from the result.
Added integration tests for Hibernate, EclipseLink and OpenJpa. EclipseLink needs a bit of special treatment as it exposes the inner join being created for a plain ….get(…) attribute traversal.
QueryUtils now checks already existing joins and reuses them when building expressions. Inspired by the pull request #41 by Alexandre Payment but polished and added integration test to make sure the joins really get reused.
Added test case to verify that it is possible to adjust the query of well known repository interface methods like findAll() via @Query.
Original pull request: #38.
Improved existingin order by detection to detect the existing clause independent of the case. Before we only detected lower case "order by" expressions.
We now make sure an alternative EntityManager (producer) is overriding a previously found EntityManager. Vice versa, we do not override a previously found one, except it marked as alternative.
As the auditing feature requires spring-aspects.jar on the classpath we issue now check whether the jar is present - if not we issue an appropriate error message. Added appropriate note to the JPA reference doc. Added test case to AuditingBeanDefinitionParserTests to verify that a XMLParserError message is emitted if the required class from spring-aspects is not on the class path.
Original pull request: #34.
Dropped the test case shouldSetTemporalQueryParameterToTimestamp(…) for DATAJPA-107 in PartTreeJpaQueryIntegrationTests as it uses Hibernate specific API, esp. API that is not available anymore in Hibernate 4.1.
Original pull request: #33.
Introduced JpaParameters abstraction to support custom jpa-specific annotations on query parameters. Adjusted Parameter binders to use the JpaParameters abstraction. Added special handling for temporal JpaParameters to ParameterBinder.bind(…) and CriteriaQueryParameterBinder.bind(…).
Adapted changes introduced in DATACMNS-350. Original pull request: #31.
Added fix in QueryUtils to work around an EclipseLinks specialty to add strict joins on a call to root.get(…) even if a later root.join(…, JoinType.LEFT) should trump this.
We needed the first call to examine the metamodel of the path obtained to decide whether to join at all in next steps. We now work around this issue by doing a lot of ugly type checking and casting on the Metamodel directly.
We filed https://bugs.eclipse.org/bugs/show_bug.cgi?id=413892 to maybe let EclipseLink improve at that point.
Original pull request: #30.
Extended JpaMetamodelEntityInformation to deal with entities with custom composite keys for which we have to derive the identifier. Introduced IdentifierDerivingDirectFieldAccessFallbackBeanWrapper that is capable of deriving identifier values. Added test case to verify the support for save / load of entities with custom composite keys.
Original pull request: #28.
Adjusted createCountQueryFor(…) in QueryUtils to leave out the order by part in the generated query. This avoids problems with databases that require columns specified in the order by clause to be in the select / group by list for count queries (e.g. H2). In addition to that this should give us a little performance boost if the database did not already optimize the query execution.
Original pull request: #29.
JpaPersistentPropertyImpl is now considered persistent if it carries a @javax.persistence.Transient annotation. This should allow persistence providers to safely generate additional fields and not cause trouble in the mapping framework this way.
Introduced ExpressionBasedStringQuery to support the SpEL expression template rendering. This allows manually defined queries in either @Query or Spring Data named queries to use SpEL and reference the #entityName. Changed SimpleJpaQuery to use ExpressionBasedStringQuery by default. Added test case for repositories with SpEL expression based query methods.
Original pull request: #25.
Adjusted scanForMappingFileLocations(…) in ClasspathScanningPersistenceUnitPostProcessor to resolve the paths to class-path loadable paths. Updated test cases accordingly. Added test case and required resources to verify that mapping files with recursive wildcard pattern can be found from multiple locations in class path.
Original pull request: #24.
We're now using AnnotationUtils.findAnnotation(…) in case of Hibernate to improve workaround for HHH-6951. Added id type caching as the annotation lookup is potentially expensive.
Added integration tests for Hibernate and EclipseLink.
Count queries are now only validated if the query method is a paging one actually. Improved the exception text in case of a validation error to indicate which method caused it.
SimpleJpaQuery now uses an explicitly created EntityManager instance to verify the manually defined query be able to close the instance explicitly. This will improve GCing the instance.
The variable put into the count(…) clause of the generated query is now the original value except we find a DTO project or a count projection in the first place.
Removed the declaration of a global PersistenceExceptionTranslationPostProcessor as the factory already applies one at the bean level selectively. Added integration tests to make sure the translation gets applied and plain @Repository classes not affected at all.
We now shortcut the execution of SimpleJpaRepository.findAll(Iterable<Integer> ids) to return an empty collection in case no ids or null are given. Previously building a query with an IN clause failed with an empty parameter list given.
PartTreeJpaQuery evaluates the newly introduced PartTree.isCountProjection() to rather trigger a derived count query instead of the actual query. Extended Query execution to potentially massage the returned value into the return type of the query method to allow long and int as return types for count queries.
If a JPA entity class has an @Version attribute we now consider this to determine whether it is new or not. So even if an id is set we'll consider it new as long as the version attribute is null.
This prevents the repository from being considered a repository a Spring bean instance has to be created for in case it is accidentally picked up during component scanning.
This commit introduces support for JPQL inline like expressions such as "… like ?1%". The implementation will detect those expressions and turn the query back into a valid JPQL one. On query execution the parameters will be bound according to the like expression defined in the query.
Modified QueryUtils.toJpaOrder(…) to apply lower criteria if ignore case on Order is set to true and the property being sorted is of type String. Upgraded to Spring Data Commons 1.6.0.BUILD-SNAPSHOT along the way.
Static factory methods on Specifications are now more lenient regarding null values eventually evaluating to null predicates on concatenation attempts.
We now build a correct count query for entities that use a compound key mapped using @IdClass. Added integration tests for EclipseLink and OpenJPA to run the basic tests of SimpleJpaRepository against different persistence providers. Ignored failing test against OpenJPA.
Added integration tests in org.springframework.data.jpa.infrastructure that will not be included in the normal test execution as they are purely means to quickly identify potential differences in persistence provider implementations.