DATACMNS-153 - Fixed class loading issue in SimpleEntityPathResolver.

The path class is loaded using the domain class' class loader instead of the one of SimpleEntityPathResolver.
This commit is contained in:
Oliver Gierke
2012-04-20 13:01:10 +02:00
parent f1516a96aa
commit ecf3592d1f

View File

@@ -18,10 +18,11 @@ package org.springframework.data.querydsl;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import com.mysema.query.types.EntityPath;
import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils;
import com.mysema.query.types.EntityPath;
/**
* Simple implementation of {@link EntityPathResolver} to lookup a query class by reflection and using the static field
* of the same type.
@@ -49,7 +50,7 @@ public enum SimpleEntityPathResolver implements EntityPathResolver {
String pathClassName = getQueryClassName(domainClass);
try {
Class<?> pathClass = ClassUtils.forName(pathClassName, SimpleEntityPathResolver.class.getClassLoader());
Class<?> pathClass = ClassUtils.forName(pathClassName, domainClass.getClassLoader());
Field field = getStaticFieldOfType(pathClass);
if (field == null) {