db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Armin Waibel" <ar...@code-au-lait.de>
Subject move LoadedObjectsRegistry
Date Mon, 28 Jul 2003 08:17:02 GMT
Hi all,

I moved LoadedObjectsRegistry class from
PB-layer to ODMG-layer to do a better code
separation. LoadedObjectsRegistry is only used
in odmg implementation.
I try to re-implement things as before.
But I think there is something strange in the current
Oleg introduced LoadedObjectsRegistry and Jamie Burns
did add a patch (posts see below).
Oleg wants to keep all objects in the registry even after
they deleted. Jamie remove objects from the registry if
PB.removeFromCache was called, but this method was called
several times when odmg-states were used - isn't it contrary???
Maybe I understand somrthing wrong. What do you think?


Oleg wrote:

This is a helper class which registers all objects loaded
 * from database. It is used by ODMG layer to determine the state of
 * objects: if an object was not loaded from database then it is new.
 * Note: objects remain registered even after they are deleted. This
 * is necessary to prevent creation of deleted objects by another
 * thread, see <a
 * for details.

Jamie Burns wrote:

I found what l believe to be a bug in PersistenceBrokerImpl.

I have an EpisodeDetails object which has a collection of
LegalSituations in an indirection table EpsDetLegSit. When a user
deletes an EpsDetLegSit it is removed ok when the transaction is
committed. However, if they try to add the EpsDetLegSit back in  in the
same VM it does not get added when the transaction is committed.

Back in November last year (2002/11/11) a change was made to the
setInitialModificationState method in ObjectEnvelope. The change looked
in a Map maintained by LoadedObjectsRegistry to see if the object had
already been loaded in the VM. If the Map contained the object,
ObjectEnvelope sets the initial state to StateOldClean. This is ok
initially, but if the object is deleted it is not removed from
LoadedObjectsRegistry. When the user tries to re-add the object,
ObjectEnvelope still thinks the object exists and sets the state of the
NEW object to StateOldClean.

The changes l am submitting remove entries from the
LoadedObjectsRegistry Map when PersistenceBrokerImpl removes entries
from its ObjectCache. (Im sending the files in 2 seperate emails. My
emails are getting bounced because of some size restriction)

In the future someone might want to look at whether it is the
responsibility of a PersistenceBroker or an ObjectCache to keep the
LoadedObjectsRegistry in synch. For now, lve made it the responsibilty
of a PersistenceBroker.


To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org

View raw message