Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 14:11
Matthew Marron is currently offline Matthew MarronFriend
Messages: 2
Registered: December 2013
Junior Member
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 18:11]

Report message to a moderator

Previous Topic:Configuring TimestampLockingPolicy via JPA Persistence Unit Property
Next Topic:Query for entity.collection returns List with one element which is null (instead of empty list)
Goto Forum:
  


Current Time: Sun Nov 19 21:50:23 GMT 2017

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

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