Closed GoogleCodeExporter closed 9 years ago
The session cache is well-documented:
https://code.google.com/p/objectify-appengine/wiki/Caching
Original comment by lhori...@gmail.com
on 17 Nov 2014 at 2:33
I agree the session cache is (fairly) well documented, but nowhere I've seen
does it spell out the fact that ignored fields will be reloaded in their
previous state and are therefore not ignored when an instance is loaded from
the cache.
Inconsistent behaviour when loading an entity depending on whether it's loaded
from the datastore or a cache is asking for trouble as where it's loaded from
is not clear to the developer.
Original comment by will.cal...@gmail.com
on 17 Nov 2014 at 2:40
Nothing is being reloaded from state. You are getting the *same* object back,
as documented. Objectify does not mangle your object instances. What do you
expect to happen?
Original comment by lhori...@gmail.com
on 17 Nov 2014 at 2:57
I understand what you're saying, but when I first noticed this I expected that
when I called .load() that ignored properties would not be loaded.
It would be ideal if calling load exhibited the same behaviour no matter where
an entity is loaded from, surely you can't disagree with that? There are
several options:
1. The tidiest but least efficient option would be to create a new instance of
the object and copy un-ignored values across to the new instance.
2. Have some kind of hacky but well documented workaround where an alternative
method can be called on the object on load to developers can set up whatever
they need to using that.
I understand there's no quick fix here. I'm not going to pretend it's a major
issue as it's fairly easy to work around, but imo it is a bug when you can't
predict how an application will behave when you make a method call.
Original comment by will.cal...@gmail.com
on 17 Nov 2014 at 3:06
No.
There are myriad reasons why a session cache returns same object instances,
many of which were hashed out on the Objectify mailing list when the session
cache was instituted. JPA and JDO sessions both work the same way, and, having
written applications with both approaches, I can quite firmly say that
Objectify's current behavior is "correct".
Original comment by lhori...@gmail.com
on 17 Nov 2014 at 9:26
Original issue reported on code.google.com by
will.cal...@gmail.com
on 17 Nov 2014 at 2:05