Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@QueryProjection does not work on @Embeddable classes #909

Closed
yrodiere opened this issue Aug 25, 2014 · 2 comments
Closed

@QueryProjection does not work on @Embeddable classes #909

yrodiere opened this issue Aug 25, 2014 · 2 comments
Labels
bug
Milestone

Comments

@yrodiere
Copy link

@yrodiere yrodiere commented Aug 25, 2014

This code won't have the corresponding projection constructor generated :

@Embeddable
public class EmbeddableTest {

    private Integer embeddedProperty;

    public EmbeddableTest() { }

    @QueryProjection
    public EmbeddableTest(Integer embeddedProperty) {
        super();
        this.embeddedProperty = embeddedProperty;
    }

    public Integer getEmbeddedProperty() {
        return embeddedProperty;
    }

    public void setEmbeddedProperty(Integer embeddedProperty) {
        this.embeddedProperty = embeddedProperty;
    }

}

Here is the generated code :

import static com.mysema.query.types.PathMetadataFactory.*;

import com.mysema.query.types.path.*;
import com.mysema.query.types.expr.*;

import com.mysema.query.types.PathMetadata;
import javax.annotation.Generated;
import com.mysema.query.types.Path;
import com.mysema.query.types.ConstructorExpression;
import com.mysema.query.types.Expression;


/**
 * QEmbeddableTest is a Querydsl query type for EmbeddableTest
 */
@Generated("com.mysema.query.codegen.EmbeddableSerializer")
public class QEmbeddableTest extends BeanPath<EmbeddableTest> {

    private static final long serialVersionUID = -886461401L;

    public static final QEmbeddableTest embeddableTest = new QEmbeddableTest("embeddableTest");

    public final NumberPath<Integer> embeddedProperty = createNumber("embeddedProperty", Integer.class);

    public QEmbeddableTest(String variable) {
        super(EmbeddableTest.class, forVariable(variable));
    }

    public QEmbeddableTest(Path<? extends EmbeddableTest> path) {
        super(path.getType(), path.getMetadata());
    }

    public QEmbeddableTest(PathMetadata<?> metadata) {
        super(EmbeddableTest.class, metadata);
    }

}

I thing this may be related to the EmbeddableSerializer, since I haven't encountered this issue on non-@Embeddable classes.

@timowest
Copy link
Member

@timowest timowest commented Aug 26, 2014

Thanks for the bug report. I added now a pull request.

@timowest timowest added the bug label Aug 26, 2014
@timowest timowest added this to the 3.4.3 milestone Aug 27, 2014
@timowest
Copy link
Member

@timowest timowest commented Aug 31, 2014

Released in 3.4.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.