mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-30 21:08:30 +08:00
#783546 : improved support for external embeddables
This commit is contained in:
parent
4e5df42ccd
commit
d3fccc4f1e
@ -25,7 +25,7 @@ public class HibernateAnnotationProcessor extends JPAAnnotationProcessor{
|
||||
|
||||
@Override
|
||||
protected DefaultConfiguration createConfiguration(RoundEnvironment roundEnv) throws ClassNotFoundException {
|
||||
return new HibernateConfiguration(roundEnv, processingEnv.getOptions(), entity, superType, embeddable, skip);
|
||||
return new HibernateConfiguration(roundEnv, processingEnv.getOptions(), entity, superType, embeddable, embedded, skip);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -29,8 +29,9 @@ public class HibernateConfiguration extends JPAConfiguration{
|
||||
Class<? extends Annotation> entityAnn,
|
||||
Class<? extends Annotation> superTypeAnn,
|
||||
Class<? extends Annotation> embeddableAnn,
|
||||
Class<? extends Annotation> embeddedAnn,
|
||||
Class<? extends Annotation> skipAnn) throws ClassNotFoundException {
|
||||
super(roundEnv, options, entityAnn, superTypeAnn, embeddableAnn, skipAnn);
|
||||
super(roundEnv, options, entityAnn, superTypeAnn, embeddableAnn, embeddedAnn, skipAnn);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@ -47,10 +47,11 @@ public class JDOAnnotationProcessor extends AbstractProcessor{
|
||||
processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "Running " + getClass().getSimpleName());
|
||||
Class<? extends Annotation> entity = (Class)Class.forName("javax.jdo.annotations.PersistenceCapable");
|
||||
Class<? extends Annotation> embeddable = (Class)Class.forName("javax.jdo.annotations.EmbeddedOnly");
|
||||
Class<? extends Annotation> embedded = (Class)Class.forName("javax.jdo.annotations.Embedded");
|
||||
Class<? extends Annotation> skip = (Class)Class.forName("javax.jdo.annotations.NotPersistent");
|
||||
|
||||
DefaultConfiguration configuration = new DefaultConfiguration(
|
||||
roundEnv, processingEnv.getOptions(), KEYWORDS, null, entity, null, embeddable, null, skip);
|
||||
roundEnv, processingEnv.getOptions(), KEYWORDS, null, entity, null, embeddable, embedded, skip);
|
||||
configuration.setUseGetters(false);
|
||||
Processor processor = new Processor(processingEnv, roundEnv, configuration);
|
||||
processor.process();
|
||||
|
||||
@ -30,7 +30,7 @@ import com.mysema.query.apt.Processor;
|
||||
@SupportedSourceVersion(SourceVersion.RELEASE_6)
|
||||
public class JPAAnnotationProcessor extends AbstractProcessor{
|
||||
|
||||
protected Class<? extends Annotation> entity, superType, embeddable, skip;
|
||||
protected Class<? extends Annotation> entity, superType, embeddable, embedded, skip;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
@ -40,6 +40,7 @@ public class JPAAnnotationProcessor extends AbstractProcessor{
|
||||
entity = (Class)Class.forName("javax.persistence.Entity");
|
||||
superType = (Class)Class.forName("javax.persistence.MappedSuperclass");
|
||||
embeddable = (Class)Class.forName("javax.persistence.Embeddable");
|
||||
embedded = (Class)Class.forName("javax.persistence.Embedded");
|
||||
skip = (Class)Class.forName("javax.persistence.Transient");
|
||||
|
||||
DefaultConfiguration configuration = createConfiguration(roundEnv);
|
||||
@ -53,7 +54,7 @@ public class JPAAnnotationProcessor extends AbstractProcessor{
|
||||
}
|
||||
|
||||
protected DefaultConfiguration createConfiguration(RoundEnvironment roundEnv) throws ClassNotFoundException {
|
||||
return new JPAConfiguration(roundEnv, processingEnv.getOptions(), entity, superType, embeddable, skip);
|
||||
return new JPAConfiguration(roundEnv, processingEnv.getOptions(), entity, superType, embeddable, embedded, skip);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -47,14 +47,15 @@ public class JPAConfiguration extends DefaultConfiguration {
|
||||
"TRAILING","TRIM","TRUE","TYPE","UNKNOWN","UPDATE","UPPER",
|
||||
"VALUE","WHEN","WHERE"));
|
||||
|
||||
private List<Class<? extends Annotation>> annotations;
|
||||
private final List<Class<? extends Annotation>> annotations;
|
||||
|
||||
public JPAConfiguration(RoundEnvironment roundEnv,Map<String,String> options,
|
||||
Class<? extends Annotation> entityAnn,
|
||||
Class<? extends Annotation> superTypeAnn,
|
||||
Class<? extends Annotation> embeddableAnn,
|
||||
Class<? extends Annotation> embeddedAnn,
|
||||
Class<? extends Annotation> skipAnn) throws ClassNotFoundException {
|
||||
super(roundEnv, options, KEYWORDS, null, entityAnn, superTypeAnn, embeddableAnn, null, skipAnn);
|
||||
super(roundEnv, options, KEYWORDS, null, entityAnn, superTypeAnn, embeddableAnn, embeddedAnn, skipAnn);
|
||||
this.annotations = getAnnotations();
|
||||
}
|
||||
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
package com.mysema.query.domain;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import javax.persistence.Embedded;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
import com.mysema.query.annotations.QueryEmbedded;
|
||||
import com.mysema.query.annotations.QueryEntity;
|
||||
import org.junit.Ignore;
|
||||
|
||||
@Ignore
|
||||
public class ExternalEmbeddableTest {
|
||||
|
||||
@QueryEntity
|
||||
@Entity
|
||||
public class EntityWithExternalEmbeddable {
|
||||
|
||||
@QueryEmbedded
|
||||
@Embedded
|
||||
EmbeddableWithoutQType embeddable;
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user