This commit is contained in:
Timo Westkämper 2011-07-04 13:43:32 +00:00
parent f0754528a0
commit 6825176bab
3 changed files with 48 additions and 3 deletions

View File

@ -440,7 +440,7 @@ public class Processor {
Element superTypeElement = env.getTypeUtils().asElement(superTypeMirror);
if (superTypeElement != null
&& !superTypeElement.toString().startsWith("java.lang.")
&& superTypeElement.getAnnotationMirrors().isEmpty()) {
&& !hasKnownAnnotation(superTypeElement)) {
typeFactory.getEntityType(superTypeMirror, false);
superTypeMirrors.add(superTypeMirror);
elements.add(superTypeElement);
@ -470,6 +470,22 @@ public class Processor {
mergeTypes(types, superTypes);
}
private boolean hasKnownAnnotation(Element element) {
if (configuration.getEmbeddableAnnotation() != null && element.getAnnotation(configuration.getEmbeddableAnnotation()) != null) {
return true;
}
if (configuration.getSupertypeSerializer() != null && element.getAnnotation(configuration.getSuperTypeAnnotation()) != null) {
return true;
}
if (element.getAnnotation(configuration.getEntityAnnotation()) != null) {
return true;
}
return false;
}
private void processDelegateMethod(Element delegateMethod, boolean cached) {
ExecutableElement method = (ExecutableElement)delegateMethod;
@ -550,7 +566,7 @@ public class Processor {
Element superTypeElement = env.getTypeUtils().asElement(superTypeMirror);
if (superTypeElement != null
&& !superTypeElement.toString().startsWith("java.lang.")
&& superTypeElement.getAnnotationMirrors().isEmpty()) {
&& !hasKnownAnnotation(superTypeElement)) {
typeFactory.getEntityType(superTypeMirror, false);
superTypeMirrors.add(superTypeMirror);
elements.add(superTypeElement);

View File

@ -27,6 +27,8 @@ public class EmbeddableDeepTest {
}
// JPA
@Entity
public class A extends AEntity {
@ -50,4 +52,29 @@ public class EmbeddableDeepTest {
}
// plain
// @QueryEntity
// public class AA extends AValueObject {
//
// @QueryEmbedded
// BB b;
//
// }
//
// @QueryEmbeddable
// public class BB extends AValueObject {
//
// @QueryEmbedded
// CC c;
//
// }
//
// @QueryEmbeddable
// public class CC extends AValueObject {
//
// SomeType someType;
//
// }
}

View File

@ -14,4 +14,6 @@ Import-Template:
net.sf.cglib.proxy.*;version="${cglib.version}",
org.apache.commons.collections15.*;version="${commons.collections.version}",
org.apache.commons.lang.*;version="${commons.lang.version}"
Excluded-Imports:
edu.umd.cs.findbugs.annotations.*,
net.jcip.annotations.*