Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.2.1, 1.3.0
-
None
-
None
Description
A method marked with @PostLoad or @PostUpdate on an object that is the toMany side of a bi-directional relationship does not get called when the other object is loaded or updated.
I can confirm that this problem was introduced by the changes done in OPENJPA-744. Looks like the StateManagerImpl.postLoad() method is not firing the event due to the bidirectional field not being flagged as loaded.
An example:
@Entity
public class Order {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "order", fetch = FetchType.EAGER)
public List<Shipment> getShipments()
}
@Entity
public class Shipment {
@ManyToOne(fetch = FetchType.EAGER, cascade =
)
public Order getOrder()
@PostLoad
public void doSomethingAfterLoad()
}
In the above example the doSomethingAfterLoad() never gets called when you load an Order. Without the changes done in OPENJPA-744 it does.