Supposing the following code snippet which uses @PrePersist and @PreUpdate annotations and Joined-type inheritance:
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
public abstract class A {
...
@PrePersist
private void prePersist() {
...
}
@PreUpdate
private void preUpdate() {
...
}
}
@Entity
@DiscriminatorValue("B")
public class B extends A {
...
@PrePersist
private void prePersist() {
...
}
@PreUpdate
private void preUpdate() {
...
}
}
Question: Can we rely on any order of execution of the callback methods?
For example when persisting class A and B will the prePersist method in B executed before the prePersist method in A or viceversa?
Can we assume that the prePersist in B will be executed before the class A is persisted?