Applied generics to JpaQueryLookupStrategy after changes in Spring Data Core.
This commit is contained in:
@@ -21,7 +21,6 @@ import javax.persistence.EntityManager;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.QueryLookupStrategy;
|
||||
import org.springframework.data.repository.query.QueryLookupStrategy.Key;
|
||||
import org.springframework.data.repository.query.QueryMethod;
|
||||
import org.springframework.data.repository.query.RepositoryQuery;
|
||||
|
||||
|
||||
@@ -39,7 +38,7 @@ public class JpaQueryLookupStrategy {
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
private static abstract class AbstractQueryLookupStrategy implements
|
||||
QueryLookupStrategy {
|
||||
QueryLookupStrategy<JpaQueryMethod> {
|
||||
|
||||
private EntityManager em;
|
||||
|
||||
@@ -57,9 +56,9 @@ public class JpaQueryLookupStrategy {
|
||||
* org.springframework.data.jpa.repository.query.QueryLookupStrategy
|
||||
* #resolveQuery(org.springframework.data.repository.query.QueryMethod)
|
||||
*/
|
||||
public final RepositoryQuery resolveQuery(QueryMethod method) {
|
||||
public final RepositoryQuery resolveQuery(JpaQueryMethod method) {
|
||||
|
||||
return resolveQuery((JpaQueryMethod) method, em);
|
||||
return resolveQuery(method, em);
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +172,8 @@ public class JpaQueryLookupStrategy {
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public static QueryLookupStrategy create(EntityManager em, Key key) {
|
||||
public static QueryLookupStrategy<JpaQueryMethod> create(EntityManager em,
|
||||
Key key) {
|
||||
|
||||
if (key == null) {
|
||||
return new CreateIfNotFoundQueryLookupStrategy(em);
|
||||
|
||||
@@ -10,7 +10,6 @@ import org.springframework.data.jpa.repository.query.JpaQueryMethod;
|
||||
import org.springframework.data.jpa.repository.query.QueryExtractor;
|
||||
import org.springframework.data.repository.query.QueryLookupStrategy;
|
||||
import org.springframework.data.repository.query.QueryLookupStrategy.Key;
|
||||
import org.springframework.data.repository.query.QueryMethod;
|
||||
import org.springframework.data.repository.support.RepositoryFactorySupport;
|
||||
import org.springframework.data.repository.support.RepositorySupport;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -21,7 +20,8 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class JpaRepositoryFactory extends RepositoryFactorySupport {
|
||||
public class JpaRepositoryFactory extends
|
||||
RepositoryFactorySupport<JpaQueryMethod> {
|
||||
|
||||
private final EntityManager entityManager;
|
||||
|
||||
@@ -79,7 +79,7 @@ public class JpaRepositoryFactory extends RepositoryFactorySupport {
|
||||
* getQueryMethod(java.lang.reflect.Method)
|
||||
*/
|
||||
@Override
|
||||
protected QueryMethod getQueryMethod(Method method) {
|
||||
protected JpaQueryMethod getQueryMethod(Method method) {
|
||||
|
||||
QueryExtractor extractor =
|
||||
PersistenceProvider.fromEntityManager(entityManager);
|
||||
@@ -111,7 +111,7 @@ public class JpaRepositoryFactory extends RepositoryFactorySupport {
|
||||
* (org.springframework.data.repository.query.QueryLookupStrategy.Key)
|
||||
*/
|
||||
@Override
|
||||
protected QueryLookupStrategy getQueryLookupStrategy(Key key) {
|
||||
protected QueryLookupStrategy<JpaQueryMethod> getQueryLookupStrategy(Key key) {
|
||||
|
||||
return JpaQueryLookupStrategy.create(entityManager, key);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public class JpaRepositoryFactoryBean<T extends JpaRepository<?, ?>> extends
|
||||
* #createRepositoryFactory()
|
||||
*/
|
||||
@Override
|
||||
protected RepositoryFactorySupport createRepositoryFactory() {
|
||||
protected RepositoryFactorySupport<?> createRepositoryFactory() {
|
||||
|
||||
return createRepositoryFactory(entityManager);
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public class JpaRepositoryFactoryBean<T extends JpaRepository<?, ?>> extends
|
||||
* @param entityManager
|
||||
* @return
|
||||
*/
|
||||
protected RepositoryFactorySupport createRepositoryFactory(
|
||||
protected RepositoryFactorySupport<?> createRepositoryFactory(
|
||||
EntityManager entityManager) {
|
||||
|
||||
return new JpaRepositoryFactory(entityManager);
|
||||
|
||||
Reference in New Issue
Block a user