DATAJPA-83 - Added getOne(ID id) to JpaRepository.

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(…)).
This commit is contained in:
Oliver Gierke
2013-10-07 16:50:52 +02:00
parent b8c81e9a2f
commit e7505b40a5
3 changed files with 34 additions and 0 deletions

View File

@@ -1093,6 +1093,18 @@ public class UserRepositoryTests {
assertThat(lastname, hasItem("Dave"));
}
/**
* @see DATAJPA-83
*/
@Test
public void looksUpEntityReference() {
flushTestUsers();
User result = repository.getOne(firstUser.getId());
assertThat(result, is(firstUser));
}
private Page<User> executeSpecWithSort(Sort sort) {
flushTestUsers();