eclipse-ee4j / eclipselink

Eclipselink project
https://eclipse.dev/eclipselink/
Other
199 stars 169 forks source link

MappedSuperclass is weaved partially. Setter/getters are not weaved #380

Open andreysubbotin opened 5 years ago

andreysubbotin commented 5 years ago

Abstract MappedSuperclass in separate JAR weaved statically. Mapped class is weaved (because it fixed in https://bugs.eclipse.org/bugs/show_bug.cgi?id=466271) but setters/getters for properties are not weaved e.g.:

@MappedSuperclass
public class TestEntity
  implements Cloneable, PersistenceWeaved, PersistenceEntity, PersistenceObject, FetchGroupTracker, PersistenceWeavedFetchGroups, ChangeTracker, PersistenceWeavedChangeTracking, PersistenceWeavedRest
{
  @NotNull
  @Column(name="TITLE", nullable=false)
  protected String title;
  static final long serialVersionUID = -694840972338274156L;
  protected transient Object _persistence_primaryKey;
  protected transient CacheKey _persistence_cacheKey;
  protected transient PropertyChangeListener _persistence_listener;
  @Transient
  @XmlTransient
  protected FetchGroup _persistence_fetchGroup;
  protected transient boolean _persistence_shouldRefreshFetchGroup;
  protected transient Session _persistence_session;
  protected transient List _persistence_relationshipInfo;
  protected transient Link _persistence_href;
  protected transient ItemLinks _persistence_links;

  public String getTitle()
  {
    return this.title;
  }

  public void setTitle(String title)
  {
    this.title = title;
  }
}

Test project: test-jpa.zip Build project (mvn package) and decompile class User

rfelcman commented 4 years ago

As a workaround helps if there is some child entity like:

package com.company.jpa;

import javax.persistence.Entity;

@Entity
public class MyEntityChild extends User{
}

Problem is if parent class with @MappedSuperclass is not used/inherited.

andreysubbotin commented 4 years ago

We use that workaround. It would be nice if it works without WA.