SGF-494 - Fix bug in GemfirePersistentEntity introduced by Spring Data Commons' ClassGeneratingPropertyAccessorFactory.

This commit is contained in:
John Blum
2016-05-05 23:33:15 -07:00
parent db41493cec
commit 8bb7013f65
3 changed files with 39 additions and 35 deletions

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.gemfire.mapping;
import org.springframework.data.mapping.PersistentEntity;
@@ -25,6 +26,7 @@ import org.springframework.util.StringUtils;
* mapped to etc.
*
* @author Oliver Gierke
* @author John Blum
*/
public class GemfirePersistentEntity<T> extends BasicPersistentEntity<T, GemfirePersistentProperty> {
@@ -41,9 +43,9 @@ public class GemfirePersistentEntity<T> extends BasicPersistentEntity<T, Gemfire
Class<T> rawType = information.getType();
Region region = rawType.getAnnotation(Region.class);
String fallbackName = rawType.getSimpleName();
String defaultRegionName = rawType.getSimpleName();
this.regionName = region == null || !StringUtils.hasText(region.value()) ? fallbackName : region.value();
this.regionName = (region != null && StringUtils.hasText(region.value()) ? region.value() : defaultRegionName);
}
/**

View File

@@ -35,16 +35,16 @@ import org.springframework.data.repository.core.support.PersistentEntityInformat
public class DefaultGemfireEntityInformation<T, ID extends Serializable> extends PersistentEntityInformation<T, ID>
implements GemfireEntityInformation<T, ID> {
private final GemfirePersistentEntity<T> entity;
private final GemfirePersistentEntity<T> persistentEntity;
/**
* Creates a new {@link DefaultGemfireEntityInformation}.
*
* @param entity must not be {@literal null}.
* @param persistentEntity must not be {@literal null}.
*/
public DefaultGemfireEntityInformation(GemfirePersistentEntity<T> entity) {
super(entity);
this.entity = entity;
public DefaultGemfireEntityInformation(GemfirePersistentEntity<T> persistentEntity) {
super(persistentEntity);
this.persistentEntity = persistentEntity;
}
/*
@@ -53,7 +53,7 @@ public class DefaultGemfireEntityInformation<T, ID extends Serializable> extends
*/
@Override
public String getRegionName() {
return entity.getRegionName();
return persistentEntity.getRegionName();
}
}