DATACMNS-376 - Repositories now inspects user class for factory lookups.

When looking up the RepositoryFactoryInformation for a domain type we now make sure we look up the user type to not accidentally try to do so for a persistence provider generated proxy class for the original type. This prevents us from not finding PersistentEntity instances, Repository- or EntityInformation accidentally.
This commit is contained in:
Oliver Gierke
2013-10-01 17:24:42 +02:00
parent e7475e5e0f
commit 59e9af4950
2 changed files with 15 additions and 2 deletions

View File

@@ -17,6 +17,7 @@ package org.springframework.data.repository.support;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -87,6 +88,16 @@ public class RepositoriesIntegrationTests {
assertThat(repositories.getCrudInvoker(Product.class), is(instanceOf(ReflectionRepositoryInvoker.class)));
}
/**
* @see DATACMNS-376
*/
@Test
public void returnsPersistentEntityForProxiedClass() {
User user = mock(User.class);
assertThat(repositories.getPersistentEntity(user.getClass()), is(notNullValue()));
}
static class User {
}