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

Generic @MappedSuperclass with @Embedded => Compiler error in _super initialization for @Entity subclass #223

Closed
mkq opened this issue Sep 3, 2012 · 6 comments

Comments

@mkq
Copy link

@mkq mkq commented Sep 3, 2012

For the following classes, Querydsl 2.7.0 shows a FilerException during generation. The generated class QFoo has a compiler error at the QBaseEntity constructor invocation.

@Embeddable 
public class Range<T extends Comparable<? super T>> { ... }

@MappedSuperclass 
public abstract class BaseEntity<T extends Comparable<? super T>> implements Serializable {
  @Embedded
  private Range<T> range;
  ...
}

@Entity
public class Foo extends BaseEntity<Integer> { ... }
@timowest
Copy link
Member

@timowest timowest commented Sep 3, 2012

Can you reproduce the issue with 2.7.2?

@mkq
Copy link
Author

@mkq mkq commented Sep 3, 2012

The latest version I find is 2.7.0. Where can i get 2.7.2?

BTW, I was planning to attach the full source and Eclipse project, but can't find an attach feature. So here it goes:

src/test/querydsl/embed/Range.java

package test.querydsl.embed;

public class Range<T extends Comparable<? super T>>
{
    private T min;
    private T max;

    public T getMin() { return min; }

    public void setMin(T min) { this.min = min; }

    public T getMax() { return max; }

    public void setMax(T max) { this.max = max; }
}

src/test/querydsl/embed/BaseEntity.java

package test.querydsl.embed;

import java.io.Serializable;

import javax.persistence.Embedded;
import javax.persistence.MappedSuperclass;

@MappedSuperclass
public abstract class BaseEntity<T extends Comparable<? super T>> implements Serializable
{
    @Embedded
    private Range<T> range;

    public Range<T> getRange()
    {
        return range;
    }

    public void setRange(Range<T> range)
    {
        this.range = range;
    }
}

src/test/querydsl/embed/Foo.java

package test.querydsl.embed;

import javax.persistence.Entity;

@Entity
public class Foo extends BaseEntity<Integer>
{
}

generate.ant.xml (called with system property like querydsl.home=D:/java/querydsl-jpa-2.7.0)

<project name="querydsl-embed-test-generate-metamodel" default="clean+generate-entity-meta">
    <path id="classpath">
        <fileset dir="${querydsl.home}" includes="**/*.jar" />
    </path>

    <property name="src.generated" value="src-generated" />

    <target name="clean">
        <delete verbose="true" includeemptydirs="true">
            <fileset dir="${src.generated}" includes="**/*" defaultexcludes="false"/>
        </delete>
    </target>

    <target name="generate-entity-meta">
        <mkdir dir="${src.generated}"/>
        <javac classpathref="classpath" includeantruntime="no" failonerror="false" fork="true">
            <src><path path="src"/></src>
            <compilerarg value="-proc:only" />
            <compilerarg value="-Aeclipselink.persistencexml=${src}/META-INF/persistence.xml" />
            <compilerarg value="-s" />
            <compilerarg value="${src.generated}" />
        </javac>
    </target>

    <target name="clean+generate-entity-meta" depends="clean, generate-entity-meta" />
</project>
@mkq
Copy link
Author

@mkq mkq commented Sep 3, 2012

Never mind the question where to get 2.7.2. I found it in http://source.mysema.com/maven2/releases/com/mysema/querydsl/querydsl-core/2.7.2/ and will try.

@timowest
Copy link
Member

@timowest timowest commented Sep 4, 2012

I can confirm, that this fails also in 2.7.2. I will provide a fix ASAP.

@mkq
Copy link
Author

@mkq mkq commented Sep 4, 2012

Thanks. As a maven noob, i was still struggling to get all needed jars for 2.7.2.

timowest added a commit that referenced this issue Sep 4, 2012
@timowest
Copy link
Member

@timowest timowest commented Sep 10, 2012

Released in 2.7.3

@timowest timowest closed this Sep 10, 2012
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