QueryUtils now only creates a join for collection properties that are explicitly annotated with an @ManyTo… annotation. This allows collection like properties like byte[] be referred to as non-collection property and thus not trigger a join when a derived query is created.
Upgraded to Spring Data build parent 1.3 RC1 and Spring Data Commons 1.7 RC1. Updated changelog and references from reference documentation. Switched to milestone repository.
The AuditingBeanFactoryPostProcessor and EntityManagerBeanDefinitionPostProcessor now correctly lookup BeanDefinitions within BeanFactory hierarchies. Also, the EMBDPP registers the EntityManager bean definition in the BeanFactory, the source BeanDefinition for the EntityManagerFactory is found.
Enabling repositories now registers a BeanFactoryPostProcessor that will register a SharedEntityManagerCreator BeanDefinition for all EntityManagerFactory definitions available in the ApplicationContext.
We register the bean name of the EMF as qualifier for the BeanDefinition for the EntityManager to allow an explicit reference in multi-EMF scenarios.
Renamed default persistence unit to spring-data-jpa.
Accessing the legacy persistence provider class in Hibernate 4.3 causes a warning being logged. As we generally want to detect the presence of Hibernate in general only, we now check for the Hibernate 4.3 persistence provider interface first to immediately find the new interface and thus avoid the warning.
Upgraded to Hibernate 4.3.1.
Was able to upgrade to EclipseLink 2.5.1 and re-enable a previously ignored integration tests. However, some of the disabled test cases still fail despite the relevant bug being reported as fixed in 2.5.1.
Turned the workaround in QueryUtils into a TODO for removal as we don't want to strongly force EclipseLink users to upgrade to 2.5.x yet.
From the CDI extension we now use the callback newly introduced in Spring Data Commons to enable it to trigger eager initialization.
See also: DATACMNS-416.
Since the location of the Hibernate EntityManager implementation changed in Hibernate 4.3 to org.hibernate.jpa.HibernateEntityManager, we now support org.hibernate.jpa.HibernateEntityManager as well as org.hibernate.ejb.HibernateEntityManager as a Hibernate PersistenceProvider.
Original pull request: #55.
Latest Hibernate 4.3 releases have changes some behavior and internals slightly. Adapted the test cases accordingly and added another guard in JpaMetamodelEntityInformation to adhere to the new behavior.
Added build profile to be able to build against Hibernate 4.3.
Decided to go with a simpler way of building up attribute paths on JpaSort to avoid the need to work with JPA Path instances (and thus the EntityManager) entirely. Added shortcut constructors to JpaSort that take a vararg of Attribute or PluralAttribute respectively.
Interestingly, the test cases still have to be integration tests as the fields in the statically generated meta-model are null until the EntityManagerFactory bootstrap process enhances them to contain actual values. So no real unit tests unfortunately.
Consolidated tests cases for MailMessageRepository into one class, especially to avoid the configuration QueryDslRepositorySupportIntegrationTests to interfere with the newly added tests. Also rather use SampleConfig configuration class to allow the test framework's caching mechanism to kick in.
Original pull request: #54.
Introduced JpaSort for sorting by JPA meta-model attribute paths. Introduced JpaMetaModelPathBuilder that can be used to ease the construction of Jpa meta-model attribute paths by the provided static factory method. Added new testing scenario (MailMessage and MailSender) to avoid to mess up the existing sample classes. Enabled static JPA meta-model generation in pom.xml.
Enhanced Querydsl to generate appropriate left joins when sorting by nested (singular) association properties. Converted XML configuration for QueryDslRepositorySupportIntegrationTests into JavaConfig.
Original pull request: #54.
Previously sorting by property of an associated object generated an inner join instead of a left join with QueryDsl and Hibernate. That excluded records that had null values on their join columns. We now generate appropriate left joins if we detect associations in the sort property expression.
Ignored test cases for EclipseLink since eclipse link generates an inner-join instead of an outer-join to fetch associations in order by. Filed: https://bugs.eclipse.org/bugs/show_bug.cgi?id=422450
Original pull request: #53.
Upgraded to Spring Data Commons 1.7.0.M1 and Spring Data Build 1.3.0.M1. Use milestone repository instead of snapshot repo. Let reference documentation refer to 1.7 M1 reference in Spring Data Commons. Updated changelog, notice and readme.
Polished the implementation of AuditingBeanFactoryPostProcessor to selectively add depends-on clauses to all bean definitions that will result in EntityManagerFactory instances eventually. Added unit tests to verify intended behavior for Java based configuration. Polished newly integrated test cases.
Removed obsolete code from AuditingEntityListener. Added configuration sample snippet. Polished reference documentation.
Original pull request: #50.
ExpressionBasedStringQuery now resolves and evaluates SpEL expressions of the actual query in the constructor and passes the resolved query to the StringQuery constructor. This enables the alias detection mechanism to work properly.
Original pull request: #51
Upgraded to Spring Data Build 1.3.0.BUILD-SNAPSHOT to benefit from upgrade to Spring Framework 3.2.4.
Made the sample mapping file in test folder a valid XML document to prevent Eclipse from marking it as error.
Simplified implementation of ParameterBinder.convertToCollectionIfNecessary(…).
Added a simpler test case for plain query execution and ignored that for EclipseLink and OpenJpa as it fails with both the EclipseLink and OpenJpa versions we currently rely on. See the ignored test cases for links to bug reports.
Original pull request: #45.
In order to support query methods with array-typed parameters (e.g. parameters passed in as varargs) correctly we have to convert such an array into a collection. Previously we passed those parameters as is which led to Exceptions in EclipseLink and Hibernate, e.g. Hibernate: IllegalArgumentException: Encountered array-valued parameter binding, but was expecting [java.lang.Integer].
Refer to the JPA ticket instead of the DATACMNS one. Use Repository instead of JpaRepository in test cases. Some code formatting.
Original pull request: #46.
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.
Corrected documentation to reflect the actual state of the @Modifying annotation which is that the clearAutomatically attribute is set to false by default. The implications of setting this attribute to true (which causes all pending non-flushed changes to be dropped) are now stated clearly.
Original pull request: #43.
The CriteriaQuery implementations unfortunately is not thread-safe for some persistence providers. E.g. Hibernate changes the state of it's implementation during the first attempt to use the instance. This causes multi-threading issues if we cache the query instance for later usage (as the instance might be used concurrently).
We now synchronize the first usage of the cached CriteriaQuery instance to guard against this situation.
Original pull request: #42.
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.