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]

Reply via email to