I have the following two simple classes:
@Entity
class Employee {
DateRange effectiveDateRange;
.....
}
@Embeddable
@EmbeddedOnly
class DateRange {
Date startDate;
Date endDate;
}
The first time the app start up and went thru a finder method on the
Employee class, the embedded effectiveDateRange would be retrieved and
information would render correctly thru the Editor framework.
However subsequent request would yield the Employee instance BUT null
on the effectiveDateRange.
Correct me if I am wrong, after looking at the logs it looks like the
embedded object was not eager fetched within the transaction-effected
finder method (it puzzles me why an embedded 1-1 relationship is not
eager fetched by default....anyway) .
On top of that RequestFactory, based on the fields requested, is
requesting a lazy fetch outside the transaction after the finder
returned. That somehow caused the level 2 cache in DataNucleus to
cache the Employee instance incorrectly, effectively marking the
cached instance as fully fetched when in fact the effectiveDateRange
field is still null.
Anyone having similar problem? I disabled the level 2 cache and it
works fine everytime.
I will try make that an eager fetch and re-enable level 2 cache to see
if it solves the problem. I am not sure if the fact that
RequestFactory is lazy loading relationship outside of a transaction
is the problem (likely I think) or there is something wrong with the
caching in DataNucleus in that it should know the version cached is
not fully fetched and therefore should fetch the relationship when
requested again.
Appreciate any insight and how people approach to solve the issue.
Thanks,
Joseph
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.