Extracted QueryHints and DefaultQueryHints into dedicated files (still package scope). Removed handling of optional CrudMethodMetadata in favour of a null object implementation of QueryHints.
Original pull request: #196.
We now make sure to apply query hints also to count queries created via Querydsl Predicates but avoid applying potential fetch graphs.
Original pull request: #196.
Formatting and generic types over raw types in Jpa21Utils. Removed superfluous EntityManager.flush() and ….clear() from EntityGraphRepositoryMethodsIntegrationTests. Formatting, spelling.
Original pull request: #192.
We now make sure to append instead of recreate subgraphs correctly when AttributeNodes already exist for a given property or dot path. This change fixes errors when creating ad hoc fetch graphs like below where multiple properties are loaded via a subgraph on the same type.
@EntityGraph(attributePaths = { "colleagues.roles", "colleagues.colleagues" })
Previously the first path was accidentally dropped. Additionally we fixed issues with the creation of "deep" ad hoc fetch graphs via @EntityGraph so that
@EntityGraph(attributePaths = { "roles", "colleagues.roles", "colleagues.colleagues.roles" })
can be used as a short form of
@NamedEntityGraph(name = "User.deepGraph",
attributeNodes = {
@NamedAttributeNode("roles"),
@NamedAttributeNode(value="colleagues", subgraph = "User.colleagues")
},
subgraphs = {
@NamedSubgraph(name = "User.colleagues", attributeNodes = {
@NamedAttributeNode("roles"),
@NamedAttributeNode(value = "colleagues", subgraph = "User.colleaguesOfColleagues")
}),
@NamedSubgraph(name="User.colleaguesOfColleagues", attributeNodes = {
@NamedAttributeNode("roles"),
})
})
})
We had to disable EclipseLink tests for this one since there seems to be a glitch when calling EntityManager.clear() prior to applying the fetch-/loadgraph causing the properties not to be in the correct load state. Omitting EntityManager.clear() is not an option since the load state is always LOADED even when leaving out query hints.
Related issue: DATAJPA-1041.
Original pull request: #192.
Related pull request: #188.
Removed build profiles for older Hibernate versions, Travis build setup for those. Removed reflection based code paths to support older versions of Hibernate.
Removed build profiles for Spring 5 and 4.3 as well.
However EntityManagerFactoryRefTests fail on cmd line when removing it though everything works fine when running tests from ide - strange things happen.
Ignored test cases failing on EclipseLink. Formatting and a bit of Javadoc.
EntityGraphRepositoryMethodsIntegrationTests.shouldRespectDynamicFetchGraphForGetOneWithAttributeNamesById() has to be ignored now as the new wiping of the EntityManager - which is needed to actually make the test test what's intended to be tested - reveals the same Eclipselink issue the newly introduced tests reveal, too.
Our bean definition check for EntityManagerFactory instances previously expected the type prediction to return exactly EntityManagerFactory. That should theoretically always be the case as the component inspecting the beans is a BeanFactoryPostProcessor, i.e. running before any of the beans should have been instantiated.
If however an EntityManagerFactoryBean is already in creation and the EntityManagerFactory backing it is already available, the factory bean will return the concrete factory's type (see AbstractEntityManagerFactoryBean.getObjectType()) so that we have to accept subtypes of EntityManagerFactory in our selection process.
Related ticket: DATAJPA-1045.
We now explicitly use a count (distinct x) clause for count queries in case the distinct flag is set on the derived query method.
Updated HibernateQueryUtils to make sure we unwrap the Query proxy properly before we invoke the lookup method via reflection.
Original pull request: #187.