You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Aaron Longwell <li...@newmedialogic.com> on 2003/08/12 18:06:25 UTC

Cache Question (M:N Relationship)

OJB Gurus,

I'm having a problem getting the cache to update in an m:n relationship. 
I am using the PB API.

I have Band entities which represent a "band" of the musical variety. I 
also have Event entities which represent a concert/party/banquet at a 
particular location. Lastly, I have a Performance entity which 
represents the convergence of a particular Band at a particular Event. 
It's an m:n relationship between Band and Event, with Performance as the 
joining table. Here's the problem scenario:

View an Event object, which nests a collection of performances. 
Drill-down to the performance itself, then delete the performance. Prior 
to the delete, the Event object (containing a nested collection of 
performances) was cached. I delete the performance via this code (not a 
complete listing):

broker.beginTransaction();
broker.delete(performance);
broker.commitTransaction();

After this process succeeds, I check the database. The performance 
record is gone. Everything goes according to plan.... EXCEPT, when I 
return to the Band OR Event screens, the listing for that performance is 
still there, despite having been removed from the database.

As a workaround, I am using a clearCache() call before every query.... I 
know exactly how "brute force" this approach is, but I needed a working 
fix ASAP.... Now I'd like to know how to do this (delete an item from a 
joining table) correctly in OJB.

Thank you for any help,
Aaron Longwell





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