Hi,

first of all, thanks for help and giving me the hints to the docs.

My goal is to avoid keeping objects in my application which are unsynchronized with the db.

So far I understood setting the refresh-attribute in collection-descriptor to "true" results in refreshing all referenced objects in the collection when the object is loaded from cache or database.

Whereas using the two-level-cache only is a performance improvement to keep the number of db-lookups small. It doesn't prevent the application from having unsynchronized data.

Maybe you could give me a hint if my conclusions described above are correct in termns of understanding how refresh and two-level-cache works?

Regards,

Abid

Alessandro Colantoni schrieb:
Hi Abid.

Do you mean that you want automatically refreshed the events collection,
without any lookup to the cache or not?.

If you want the collection to be refreshed on look up you can
use collection-descriptor refresh attribute or the two level cache
http://db.apache.org/ojb/docu/guides/repository.html#collection-descriptor
http://db.apache.org/ojb/docu/guides/objectcache.html#two-level

I dont't think you could avoid a lookup, anyway a first idea could be to
make it hidden to the eventType user.
For example you could hide the lookup in the method getEvents of the class
EventType

Regards
Alessandro


On Wed, Oct 22, 2008 at 10:00 AM, Abid Hussain <[EMAIL PROTECTED]>wrote:

Hello everybody,

I except not to be the first one to ask this question, but haven't found
anything in the archives.

My question is about synchronization resp. caching of 1:n relations. Let's
say, we have two entities:
class Event {
       int id;
       int eventTypeId;
       EventType eventType;
       // ... other fields
}
class EventType {
       int id;
       Collection<Event> events;
       // ... other fields
}
So, there is a 1:n relationship between EventType and Event - EventType is
on the 1-side and Event is on the n-side.

Let's look at the following:
(1) We fetch an EventType (called evType) from DB incl. all the associated
Events.
(2) Another user deletes an Event from the DB which was associated with the
previously fetched EventType.
(3) At this point, an Event is included in the evType's events-collection
which doesn't exist any more cause it was deleted in (2).

Is there any caching or synchronization mechanism to avoid the problem in
(3)?

Regards,

Abid


--

Abid Hussain
Mail: [EMAIL PROTECTED]
Web: http://www.abid76.de

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




--

Abid Hussain
Mail: [EMAIL PROTECTED]
Web: http://www.abid76.de


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

Reply via email to