Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Generated metamodel doesn't extend base metamodel from another jar
Generated metamodel doesn't extend base metamodel from another jar [message #1476586] Mon, 17 November 2014 07:13
Sergey Ka is currently offline Sergey KaFriend
Messages: 1
Registered: November 2014
Junior Member
I created two Maven projects using Netbeans 8.0.1 to illustrate a problem: common1 and common2 (jars).

common1:

package pck1

@MappedSuperclass
public class Entity1 implements Serializable {
    @Basic(optional = false)
    @Column(name = "val")
    protected String val;
}


package pck2

@Entity
@Table(name = "entity2")
public class Entity2 extends Entity1 {
    @Id
    private Long id;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
}

persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence ...>
  <persistence-unit name="PU-1" transaction-type="RESOURCE_LOCAL">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
  </persistence-unit>
</persistence>

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project ...>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.ent</groupId>
    <artifactId>common1</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>eclipselink</artifactId>
            <version>2.5.2</version>            
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
            <version>2.5.2</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>    
</project>

common2

package pck3

@Entity
@Table(name = "entity3")
public class Entity3 extends Entity1 {
    @Id
    private Long id;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
}

persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence ...>
    <persistence-unit name="PU-2" transaction-type="RESOURCE_LOCAL">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <exclude-unlisted-classes>false</exclude-unlisted-classes>
    </persistence-unit>
</persistence>

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project ...>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.ent</groupId>
    <artifactId>common2</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>com.ent</groupId>
            <artifactId>common1</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>eclipselink</artifactId>
            <version>2.5.2</version>            
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
            <version>2.5.2</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>    
</project>

After build process I see generated sources with canonical metamodels in Netbeans:

common1

package pck1

@Generated(value="EclipseLink-2.5.2.v20140319-rNA", date="2014-11-11T13:39:25")
@StaticMetamodel(Entity1.class)
public class Entity1_ { 

    public static volatile SingularAttribute<Entity1, String> val;

}

package pck2

@Generated(value="EclipseLink-2.5.2.v20140319-rNA", date="2014-11-11T13:39:25")
@StaticMetamodel(Entity2.class)
public class Entity2_ extends Entity1_ {

    public static volatile SingularAttribute<Entity2, Long> id;

}

common2

package pck3

@Generated(value="EclipseLink-2.5.2.v20140319-rNA", date="2014-11-11T13:39:31")
@StaticMetamodel(Entity3.class)
public class Entity3_ { 

    public static volatile SingularAttribute<Entity3, Long> id;

}

The question is why Entity3_ not extends Entity1_ as Entity2_? What am I doing wrong?
  • Attachment: commons.7z
    (Size: 1.40KB, Downloaded 104 times)
Previous Topic:@PreUpdate on One of OneToMany?
Next Topic:Lazy OneToOne Relationship traversed on Insert
Goto Forum:
  


Current Time: Wed Jul 24 13:29:47 GMT 2024

Powered by FUDForum. Page generated in 0.03580 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top