I'm confused by a surprising behaviour of eclipselink 2.5.2. In same cases the transient fields of an entity are set with the last value after loading the object. From my point of view there is no definition how the state of transient fields should be after loading (see https://download.oracle.com/otn-pub/jcp/persistence-2.0-fr-oth-JSpec/persistence-2_0-final-spec.pdf?AuthParam=1551111289_d4f5a797aa325dac1adb64fb8b75c2af). Can anyone explain these behaviour?
I prevend the behaviour and set all @Transient fields within a @PostLoad annotated method to null.
@Entity
@Cacheable(true)
@Cache(expiry = 300000)
@Table(uniqueConstraints=@UniqueConstraint(name = "uc_b_a_v", columnNames = {"a_id", "v"}))
public class Entity {
@Transient
private String transientfield;
@PostLoad
public void onPostLoad() {
transientfield = null;
}
}