Hello,

Recently I've stumbled onto a very similar problem. Upon deleting
various objects subsequent reads obtain, from the cache, objects which
are no longer in the database!

A temporary quick fix to this problem was to clear the cache upon
committing the transaction; however this degrades efficiency.

I also had a quick look at what the persistent broker did when
committing a transaction in which objects are deleted from the database.
>From what I could make out it simply does nothing! I am running OJB in
singlevm mode, in which case the following lines of code are executed:

             ------------------------------
// if running in singlevm mode simply remove from local cache
else
{
   // as resolution to #OJB1 I commented out the following line
   // removeFromCache(oid);
}
             ------------------------------
            
Why isn't the object removed from the cache, in other words what is
"resolution to #OJB1"?

Thanks in advance,
Luis Cruz


On Wed, 2003-03-12 at 17:02, Armin Waibel wrote:
> Hi Will,
> 
> I have checked in a test case to reproduce
> your problem. See CollectionsTest.java.
> The test is passed, please have a look at it. 
> 
> > have a web application, so let's say the user chooses a Trainee and
> > clicks Delete. The action does the following, each in a separate ODMG
> > transaction.
> >
> > - (the Faculty object has previously been retreived and put into the
> > session.)
> > - get the Trainee object using the OID, delete the trainee (both in
> one tx)
> you have to reset the Trainee List in Faculty and lock this too,
> because the Faculty object in the cache could not know (or say
> we do not have such a sophisticated cache implementation ;-))
> that one of the references was deleted.
> When using the ObjectCacheEmptyImpl this could not
> happen, then every object was retrieved from the DB.
> 
> If the test case does not reproduce you problem could
> you please post me a modified version?
> 
> HTH
> 
> regards,
> Armin
> 
> 
> > - get the Faculty object using the OID
> >
> > I then put the Faculty into the sessions and use its trainee
> collection
> >   to populate a dropdown box of Trainees. What happens is that the
> > deleted trainee continues to appear in the list. Via debugging I can
> see
> > that the Faculties trainee collection still has the deleted trainee.
> >
> > It seems that the Faculty object is always gotten from the cache and
> > never from the db, so the Trainee collection is wrong. I have to
> restart
> > my application server in order for the correct collection to show.
> >
> > This make so sense to me. Clearly I'm not understanding the cache.
> >
> > Will


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to