Merge pull request #911 from querydsl/i909

Fix projection handling for embeddable types
This commit is contained in:
Timo Westkämper 2014-08-27 21:21:08 +03:00
commit 9b0f71f4c8
3 changed files with 43 additions and 19 deletions

View File

@ -44,6 +44,7 @@ public class GenericExporterTest extends AbstractProcessorTest {
expected.add("QQueryProjectionTest_DTOWithProjection.java");
expected.add("QQueryProjectionTest_EntityWithProjection.java");
expected.add("QEmbeddable3Test_EmbeddableClass.java");
// FIXME
expected.add("QExternalEntityTest_MyEntity.java");
@ -82,6 +83,7 @@ public class GenericExporterTest extends AbstractProcessorTest {
expected.add("QTemporal2Test_Cheque.java");
expected.add("QQueryProjectionTest_DTOWithProjection.java");
expected.add("QQueryProjectionTest_EntityWithProjection.java");
expected.add("QEmbeddable3Test_EmbeddableClass.java");
// FIXME
expected.add("QGeneric4Test_HidaBez.java");

View File

@ -0,0 +1,37 @@
package com.mysema.query.domain;
import com.mysema.query.annotations.QueryEmbeddable;
import com.mysema.query.annotations.QueryProjection;
import com.mysema.query.support.Expressions;
import org.junit.Test;
public class Embeddable3Test {
@QueryEmbeddable
public static class EmbeddableClass {
private Integer embeddedProperty;
public EmbeddableClass() { }
@QueryProjection
public EmbeddableClass(Integer embeddedProperty) {
super();
this.embeddedProperty = embeddedProperty;
}
public Integer getEmbeddedProperty() {
return embeddedProperty;
}
public void setEmbeddedProperty(Integer embeddedProperty) {
this.embeddedProperty = embeddedProperty;
}
}
@Test
public void test() {
QEmbeddable3Test_EmbeddableClass.create(Expressions.path(Integer.class, "num"));
}
}

View File

@ -13,30 +13,20 @@
*/
package com.mysema.query.codegen;
import static com.mysema.codegen.Symbols.UNCHECKED;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.util.Collection;
import javax.inject.Inject;
import javax.inject.Named;
import com.mysema.codegen.CodeWriter;
import com.mysema.codegen.model.ClassType;
import com.mysema.codegen.model.Type;
import com.mysema.codegen.model.TypeCategory;
import com.mysema.codegen.model.Types;
import com.mysema.query.types.Path;
import com.mysema.query.types.path.BeanPath;
import com.mysema.query.types.path.BooleanPath;
import com.mysema.query.types.path.ComparablePath;
import com.mysema.query.types.path.DatePath;
import com.mysema.query.types.path.DateTimePath;
import com.mysema.query.types.path.EnumPath;
import com.mysema.query.types.path.NumberPath;
import com.mysema.query.types.path.StringPath;
import com.mysema.query.types.path.TimePath;
import com.mysema.query.types.path.*;
import static com.mysema.codegen.Symbols.UNCHECKED;
/**
* EmbeddableSerializer is a {@link Serializer} implementation for embeddable types
@ -96,9 +86,4 @@ public final class EmbeddableSerializer extends EntitySerializer {
writer.privateStaticFinal(Types.LONG_P, "serialVersionUID", model.hashCode() + "L");
}
@Override
protected void introFactoryMethods(CodeWriter writer, EntityType model) throws IOException {
// no factory methods
}
}