You will need to manage the cache by yourself. It is a simple cache and is
not automatically kept consistent.
Calling broker.clearCache() is a bit too much for my taste, I mostly use
"broker.removeFromCache(obj)", which will do what you expect (I think).
The cache is great for performance if you have many reads, but must be
managed with some care whenever objects are written. Use removeFromCache liberally,
or use clearCache to wipe it completely clean. And take a look at the source code
of the implementation you have selected to see what it actually does, so that you
understand the cause and the effects.
Regards,
Theo Niemeijer
> -----Oorspronkelijk bericht-----
> Van: BURT, RANDALL (CONTRACTOR) [mailto:[EMAIL PROTECTED]
> Verzonden: dinsdag 3 juni 2003 21:39
> Aan: OJB Users List
> Onderwerp: RE: [Newbie] deleting objects in inverse relationship
>
>
> Not a guru by any means, but try calling broker.clearCache() after the delete, or
> use ObjectCacheEmptyImpl in your
> OJB.properties and see if that works. Seems that the cache causes many of these
> inconsistencies.
>
> Sorry if this is crap advice, but I don't know as much as I'd like about OJB, and it
> sucks sometimes waiting for these
> fine (but very busy) folks to reply.
>
> -----Original Message-----
> From: Denis Avdic [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 03, 2003 2:34 PM
> To: OJB Users List
> Subject: Re: [Newbie] deleting objects in inverse relationship
>
>
> No takers on this?
> I could not find anything in the docs to answer this question, that is
> why i turned here. Anyone?
>
> Denis Avdic wrote:
>
> > Hello,
> >
> > I have a small problem and I was wondering if anyone on this list
> > would know the answer...
> >
> > I have a relatively simple database and I have a couple of inverse
> > foreign key relationship between some objects.
> >
> > In my "parent" object I have
> >
> > <collection-descriptor
> > name="responses"
> > element-class-ref="com.blah.blah.beans.Response"
> > auto-retrieve="true"
> > auto-update="true"
> > auto-delete="true"
> > >
> > <inverse-foreignkey field-ref="submissionId"/>
> > </collection-descriptor>
> >
> >
> > I am using the PersistenceBroker interface and when I need to delete a
> > response I delete it with:
> >
> > Criteria c = null;
> > Query q = null;
> > for (int i = 0; i < out.size(); i++) {
> > Response temp = (Response) out.get(i);
> >
> > c = new Criteria();
> > c.addEqualTo("id", Integer.toString(temp.getId()));
> > q = new QueryByCriteria(Response.class, c);
> > broker.deleteByQuery(q); }
> >
> > Now, the response is deleted from the database (I checked). However,
> > when I try to access the page again, it displays the responses there
> > (since I retrieve my submissions and I take all the responses
> > retrieved with the submissions). So, I am not sure how to avoid this
> > behavior. I need to retrieve by submission, not by response, so is
> > there a way to update (I presume) the cache to reflect the changed DB
> > state?
> >
> > Thanks,
> >
> > Denis
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]