On Mar 30, 2005, at 9:11 PM, Craig Turner wrote:
> Yes. The getter on my method getFirstname() returns null (incorrect)
> before I refetch it, and the correct String after a refetch. So maybe
> there's a break in my situation in the cache or between the object and
> the cache. Notably, the object seems to be losing its datacontext
> along the way, but I'm not doing anything in my code that would
> obviously cause this.
This is related to how deserialization is performed (this was discussed
here and probably in other places:
http://objectstyle.org/cayenne/lists/cayenne-user/2005/03/0105.html ).
I don't think we have a JIRA issue though. Can you please submit a
report, or otherwise it'll get lost again.
> We've just been talking about thsi situation in the office, and
> there's an easier workaround than the one I'm using above: I could
> just pass the id into the parameters instead of the whole object and
> then fetch the object out of a list.
Yep, this is a good solution ... Besides you don't have to refetch (in
a sense of doing a DB round trip), just use DataObjectUtils.objectForPK
- it will get an object from cache or refetch as needed (so it will do
the most efficient thing transparently), and also attach this object to
your current DataContext.
Andrus
This archive was generated by hypermail 2.0.0 : Wed Mar 30 2005 - 21:25:24 EST