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

@QueryEmbedded generates a wrong type in subclass in some cases #104

Closed
teijov opened this issue Feb 26, 2012 · 2 comments
Closed

@QueryEmbedded generates a wrong type in subclass in some cases #104

teijov opened this issue Feb 26, 2012 · 2 comments

Comments

@teijov
Copy link

@teijov teijov commented Feb 26, 2012

If fooOfSuperclass is declared like this:

package com.company.framework;
@QueryEntity
public class Superclass {
    ...
    @QueryEmbedded
    private List<IdNamePair<String>> fooOfSuperclass = new ArrayList<IdNamePair<String>>();
    ...
}

the generated Q-class is:

@Generated("com.mysema.query.codegen.EntitySerializer")
public class QSuperclass extends EntityPathBase<Superclass> {
    ...
    public final ListPath<IdNamePair<String>, QIdNamePair> fooOfSuperclass = this.<IdNamePair<String>, QIdNamePair>createList("fooOfSuperclass", IdNamePair.class, QIdNamePair.class);
    ...
}

When the Superclass is inherited:

package com.company.client
@QueryEntity
public class Subclass extends com.company.framework.Superclass {
    private int number;
}

The generated Q-class for the Subclass is:

@Generated("com.mysema.query.codegen.EntitySerializer")
public class QSubclass extends EntityPathBase<Subclass> {
    ...
     //inherited
    public final ListPath<com.company.framework.IdNamePair<String>, ComparablePath<com.company.framework.IdNamePair<String>>> fooOfSuperclass = _super.fooOfSuperclass;
    public final NumberPath<Integer> number = createNumber("number", Integer.class);
   ...
}

The problem is that the type parameter of this.fooOfSuperclass is ComparablePath instead of QIdNamePair. This causes the QSubclass not to compile since type parameter of _super.fooOfSuperclass is QIdNamePair.

timowest added a commit that referenced this issue Feb 27, 2012
@timowest
Copy link
Member

@timowest timowest commented Feb 27, 2012

This issue appeared only when the supertype appeared in a different module. External QueryEmbedded types are now properly tracked.

@timowest
Copy link
Member

@timowest timowest commented Mar 11, 2012

released in 2.3.3

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

Successfully merging a pull request may close this issue.

None yet
2 participants