Add support for marking a repository with @Region rather than the entity

This commit is contained in:
Pid
2014-03-04 00:39:53 +00:00
committed by John Blum
parent 06d3f62cac
commit 5f98eb66b5
6 changed files with 171 additions and 2 deletions

View File

@@ -102,10 +102,18 @@ public class GemfireRepositoryFactory extends RepositoryFactorySupport {
private GemfireTemplate getTemplate(RepositoryMetadata metadata) {
Class<?> repositoryClass = metadata.getRepositoryInterface();
Class<?> domainClass = metadata.getDomainType();
GemfirePersistentEntity<?> entity = context.getPersistentEntity(domainClass);
GemfirePersistentEntity<?> entity;
if (repositoryClass.isAnnotationPresent(org.springframework.data.gemfire.mapping.Region.class)) {
entity = context.getPersistentEntity(repositoryClass);
}
else {
entity = context.getPersistentEntity(domainClass);
}
Region<?, ?> region = regions.getRegion(domainClass);
Region<?, ?> region = regions.getRegion(entity.getRegionName());
if (region == null) {
throw new IllegalStateException(String.format(