@Transient override for subclass

I know there are no plans to be able to remove an attribute mapped by a superclass but … ^^

I am working on a big and old project (efluid - created year 2000) and it is complex to modify the modeling of main objects which does not respect this constraint

A solution that I implemented to overcome this is to put @Transient on the attributes of the parent class (which in my case is abstract …), to use on the daughter class @Access ( AccessType.PROPERTY) and then redefine the getters of the fields I want to map.

@MappedSuperclass
public class EfluidBusinessObject {
  @Id
  String id;

  @Transient
  private Timestamp dateCreation;

  public Timestamp getDateCreation() {
    return dateCreation;
  }
...
}

@Entity
@Access(PROPERTY)
public class Contrat extends EfluidBusinessObject {

  @Override
  public Timestamp getDateCreation() {
    return super.getDateCreation();
  }
...
}

What do you think ?

Also this constraint is very restrictive or even blocking :slight_smile:
Is it technical or political not to want @Transient an attribute mapped by the parent class?

Your solution looks fine to me. What’s your problem with that? There is no way fields can be removed from super classes, that’s just impossible design-wise.

My solution is operational, it was just to find out if there was another way to do it or if it was not right to do it like this.
But a priori it is good, so I leave it like that and it is that I would propose if it is not possible to lower the attributes in the child classes.

Thanks to you