You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Karl Richter (JIRA)" <ji...@apache.org> on 2018/02/03 21:16:02 UTC

[jira] [Created] (OPENJPA-2728) Metamodel generation of entity or mapped superclass

Karl Richter created OPENJPA-2728:
-------------------------------------

             Summary: Metamodel generation of entity or mapped superclass
                 Key: OPENJPA-2728
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2728
             Project: OpenJPA
          Issue Type: Bug
            Reporter: Karl Richter
             Fix For: 3.0.0


A simple entity or mapped superclass with a generic type parameter causes the metamodel generation to fail because of syntax errors, e.g.


{code:java}
@MappedSuperclass
public abstract class MyEntity2<T extends MyEntity> implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue
    private Long id;
    private T myEntity;
{code}

causes the generation of

{code:java}
import java.lang.Long;
import javax.persistence.metamodel.SingularAttribute;

@javax.persistence.metamodel.StaticMetamodel
(value=richtercloud.openjpa.generic.metamodel.MyEntity2.class)
@javax.annotation.Generated
(value="org.apache.openjpa.persistence.meta.AnnotationProcessor6",date="Sat Feb 03 20:59:32 CET 2018")
public class MyEntity2_ {
    public static volatile SingularAttribute<MyEntity2,Long> id;
    public static volatile SingularAttribute<MyEntity2,T> myEntity;
}
{code}

which is invalid because `T` isn't specified and thus unknown to the compiler.

A SSCCE is provided at https://gitlab.com/krichter/openjpa-generic-metamodel.

experienced with 3.0.0-SNAPSHOT



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)