DATACMNS-49 - Added integration for Spring Data named queries.

We now support extracting query definitions into a properties file which can be configured on the JpaRepositoryFactoryBean. The namespace will look for classpath*:META-INF/jpa-named-queries.properties by default.
This commit is contained in:
Oliver Gierke
2011-06-23 19:47:59 +02:00
parent dae766d579
commit 5d3602d53f
7 changed files with 60 additions and 27 deletions

View File

@@ -811,6 +811,17 @@ public class UserRepositoryTests {
}
@Test
public void findsUsersBySpringDataNamedQuery() {
flushTestUsers();
List<User> result = repository.findBySpringDataNamedQuery("Gierke");
assertThat(result.size(), is(1));
assertThat(result, hasItem(firstUser));
}
private Page<User> executeSpecWithSort(Sort sort) {
flushTestUsers();

View File

@@ -212,4 +212,7 @@ public interface UserRepository extends JpaRepository<User, Integer>,
List<SpecialUser> findSpecialUsersByLastname(String lastname);
List<User> findBySpringDataNamedQuery(String lastname);
}