Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » MappedSuperclass methods not getting weaved(MappedSuperclass methods are not getting weaved in a specific case.)
MappedSuperclass methods not getting weaved [message #1220772] Fri, 13 December 2013 09:11
Eclipse UserFriend
If you have the following situation:

@MappedSuperclass
public abstract class BaseEntityObject {
  private Integer myInt;

  @Column(name = "SOME_COLUMN")
  public Integer getSomeColumn() {
    return myInt;
  }

  public void setSomeColumn(Integer value) {
    myInt = value;
  }
}

...
@Entity
public class EntityA extends BaseEntityObject {
  private Integer myOverridingInt;

  @Column(name = "SOME_COLUMN")
  public Integer getSomeColumn() {
    return myOverridingInt;
  }

  public void setSomeColumn(Integer value) {
    myOverridingInt = value;
  }
}

@Entity
public class EntityB extends BaseEntityObject {
}


If EntityA's someColumn field gets weaved first, the BaseEntityObject's someColumn never gets weaved. However, if EntityB gets weaved first, both EntityA.someColumn and BaseEntityObject.someColumn get weaved.

This is because the static weaver builds up a list of 'unMapped' fields. When EntityA is weaved, the unMapped fields set becomes empty. So when the superclass (BaseEntityObject) gets processed, it never visits the 'someColumn' field for weaving.

Is there a bug for this? Should this be a bug? Or should mapped properties on base classes be required to be final?

From the eclpselink jar's manifest (for version info):
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 17.0-b16 (Sun Microsystems Inc.)
Specification-Title: Eclipse Persistence Services
Specification-Vendor: Eclipse.org - EclipseLink Project
Specification-Version: 2.4.2
Implementation-Title: org.eclipse.persistence
Implementation-Vendor: Eclipse.org - EclipseLink Project
Implementation-Version: 2.4.2.v20130514-5956486
Release-Designation: EclipseLink 2.4.2
Premain-Class: org.eclipse.persistence.internal.jpa.deployment.JavaSEC
MPInitializerAgent
Main-Class: org.eclipse.persistence.Version

[Updated on: Fri, 13 December 2013 13:11] by Moderator

Previous Topic:using UNION with ORDER BY clause
Next Topic:Update entity with relation to persistent entity
Goto Forum:
  


Current Time: Mon Jul 07 05:03:18 EDT 2025

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

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

Back to the top