Hi, I came across a weird behavior when using fetch=FetchType.LAZY in a complex code. However I am unable to reproduce the behavior in a simple code.
The behavior is like below:
1. When I am using in object declaration
@OneToMany(fetch=FetchType.EAGER, cascade = CascadeType.ALL)
private LinkedList<OdbObject> referencedObj;
My test suite is running well.
2. However when I change fetch to LAZY
@OneToMany(fetch=FetchType.LAZY, cascade = CascadeType.ALL)
private LinkedList<OdbObject> referencedObj;
It seems referencedObj is becoming null for a certain condition. (I checked by inserting code at @PreUpdate).
The referencedObj is becoming null is after executing the following line:
em.detach(this);
Regards,
--
eko