diff --git a/querydsl-apt/src/main/java/com/querydsl/apt/jpa/JPAConfiguration.java b/querydsl-apt/src/main/java/com/querydsl/apt/jpa/JPAConfiguration.java index bbc764987..e9c3152a7 100644 --- a/querydsl-apt/src/main/java/com/querydsl/apt/jpa/JPAConfiguration.java +++ b/querydsl-apt/src/main/java/com/querydsl/apt/jpa/JPAConfiguration.java @@ -113,7 +113,12 @@ public class JPAConfiguration extends DefaultConfiguration { } if (mirror != null) { TypeMirror typeArg = TypeUtils.getAnnotationValueAsTypeMirror(mirror, "targetEntity"); - TypeMirror erasure = types.erasure(element.asType()); + TypeMirror erasure; + if (element instanceof ExecutableElement) { + erasure = ((ExecutableElement) element).getReturnType(); + } else { + erasure = types.erasure(element.asType()); + } TypeElement typeElement = (TypeElement) types.asElement(erasure); if (typeElement != null && typeArg != null) { if (typeElement.getTypeParameters().size() == 1) {