db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Armin Waibel <arm...@apache.org>
Subject Re: ojb 1.1 ideas and proposals
Date Tue, 13 Jul 2004 10:08:42 GMT
Hi,

Brian McCallister wrote:
> 
>>
>> Both JCDs and models can be reused across PCs, e.g. copying objects 
>> from one db to another is accomplished by using the same model but a 
>> different connection descriptor.
>> As an additional enhancement, it should be possible to declare 
>> multiple SequenceManagers within one JCD (each with an unique 
>> identifier, and one being the default one).
> 
> 
> So, how would it handle multiple models (we need a better term, that is 
> too overloaded)

+0 agree, but what are the alternative/better terms?

 > against the same JCD? It would be a new PC instance and
> separate configuration of OJB... Would caching be shared in any way?
> 
> This starts to point to possible need for in-jvm "distributed" cache.
> 

Brian, you've got me there ;-)
This is the big issue. And I think it is not possible to fit all 
expectations. Let me explain,

1) Someone define one model and two or more JCD (representing different 
DB). The two PersistenceConfiguration (PC) use the same model but 
different DB. In that case we have to use one cache instance for each 
PC, because we have to guarantee cache synchronization with the DB.
Easy case ;-)

2) Someone define one model and two or more JCD (representing the SAME 
DB, e.g. different DB user/roles for the same DB). The two 
PersistenceConfiguration (PC) use the same model and same DB. In that 
case we have to share the cache between the PC's.

3) Someone define two or more models for the same JCD using the same 
classes. One model GUEST and a model USER. In the GUEST model 
class-descriptor's some field-descriptor are hidden (removed) compared 
with the USER model.
(e.g. similar example will be a NORMAL and FAST model and the fast model 
hide all Blob/Clob fields, ...).
In that case we can't share the cache, because if you switch from GUEST 
to USER model (using the corresponding PC) you can found limited objects 
from the GUEST model in cache (if shared).
But if we not share the cache and using different caches for USER and 
GUEST models, persistent operations done by one model are not reflected 
in the other one's cache. So after doing update/remove operations on 
USER model, you can found outdated/removed objects in GUEST model.

Only solution I found was to introduce an InvalidationListener
interface InvalidationListener
{
   invalidateObject(Identity oid);
}
Each cache (the cache itself or a wrapper or broker) can handle 
InvalidationListener and call 'invalidateObject' for each updated, 
removed object and each cache implements this listener. So we can 
register cache-GUEST and cache-USER one another.
If now in cache-USER an object was update/removed on cache-GUEST 
'invalidateObject' was called and the object will be removed from 
cache-GUEST.
I think this is similar to the "in-jvm distributed cache" Brian pointing to.


regards,
Armin

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


Mime
View raw message