You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Tore Halset <ha...@pvv.ntnu.no> on 2010/06/07 09:27:31 UTC
delete via jdbc
Hello.
I am deleting some rows via jdbc and want to update the cayenne stack with that information. After issuing ctxt.invalidateObjects(...) the cayenne objects for the deleted rows still have persistence state comitted. Is there a better trick than invalidateObjects(...)?
- Tore.
Re: delete via jdbc
Posted by Joe Baldwin <jf...@earthlink.net>.
Yes that is our configuration. OK, "hands off" is fine with me. :)
On Jun 8, 2010, at 11:42 AM, Andrus Adamchik wrote:
> Yeah I'd say it is superfluous in the recommended configurations (i.e. if you bind a context to a session, and logging out equals session termination).
>
> Andrus
>
> On Jun 8, 2010, at 8:15 AM, Joe Baldwin wrote:
>
>> Andrus,
>>
>> I read this post by you and am wondering should I initiate an "unregisterObjects" in the normal course of events, when say someone is logging out (in a webstore design pattern) to "suggest" memory management events, or is that superfluous and your "weak reference" algorithm is sufficient?
>>
>> Joe
>>
>>
>> On Jun 7, 2010, at 11:04 AM, Andrus Adamchik wrote:
>>
>>> Invalidate should hollow the objects, but keep their references in the context (they shouldn't resolve to committed though, so I am surprised about that).
>>>
>>> DataContext also has a method "unregisterObjects" (not a part of ObjectContext interface) that should forget about the objects in a given context, clear the shared cache, and send invalidate event to peer contexts.
>>>
>>> Andrus
>>>
>>>
>>> On Jun 7, 2010, at 7:58 AM, Tore Halset wrote:
>>>
>>>> Well, processSnapshotChanges did not solve the problem either. I am now doing deleteObjects() after deleting them via plain jdbc. It is not pretty, but works well as long as the objects are in state COMITTED.
>>>>
>>>> - Tore.
>>>>
>>>> On Jun 7, 2010, at 12:27, Tore Halset wrote:
>>>>
>>>>> Hello.
>>>>>
>>>>> This one seem to work much better.
>>>>>
>>>>> ((DataContext) ctxt).getObjectStore().getDataRowCache().processSnapshotChanges(this,
>>>>> Collections.EMPTY_MAP, deletedIds, Collections.EMPTY_LIST,
>>>>> Collections.EMPTY_LIST);
>>>>>
>>>>> - Tore.
>>>>>
>>>>> On Jun 7, 2010, at 09:27 , Tore Halset wrote:
>>>>>
>>>>>> Hello.
>>>>>>
>>>>>> I am deleting some rows via jdbc and want to update the cayenne stack with that information. After issuing ctxt.invalidateObjects(...) the cayenne objects for the deleted rows still have persistence state comitted. Is there a better trick than invalidateObjects(...)?
>>>>>>
>>>>>> - Tore.
>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
>
Re: delete via jdbc
Posted by Andrus Adamchik <an...@objectstyle.org>.
Yeah I'd say it is superfluous in the recommended configurations (i.e.
if you bind a context to a session, and logging out equals session
termination).
Andrus
On Jun 8, 2010, at 8:15 AM, Joe Baldwin wrote:
> Andrus,
>
> I read this post by you and am wondering should I initiate an
> "unregisterObjects" in the normal course of events, when say someone
> is logging out (in a webstore design pattern) to "suggest" memory
> management events, or is that superfluous and your "weak reference"
> algorithm is sufficient?
>
> Joe
>
>
> On Jun 7, 2010, at 11:04 AM, Andrus Adamchik wrote:
>
>> Invalidate should hollow the objects, but keep their references in
>> the context (they shouldn't resolve to committed though, so I am
>> surprised about that).
>>
>> DataContext also has a method "unregisterObjects" (not a part of
>> ObjectContext interface) that should forget about the objects in a
>> given context, clear the shared cache, and send invalidate event to
>> peer contexts.
>>
>> Andrus
>>
>>
>> On Jun 7, 2010, at 7:58 AM, Tore Halset wrote:
>>
>>> Well, processSnapshotChanges did not solve the problem either. I
>>> am now doing deleteObjects() after deleting them via plain jdbc.
>>> It is not pretty, but works well as long as the objects are in
>>> state COMITTED.
>>>
>>> - Tore.
>>>
>>> On Jun 7, 2010, at 12:27, Tore Halset wrote:
>>>
>>>> Hello.
>>>>
>>>> This one seem to work much better.
>>>>
>>>> ((DataContext)
>>>> ctxt
>>>> ).getObjectStore().getDataRowCache().processSnapshotChanges(this,
>>>> Collections.EMPTY_MAP, deletedIds,
>>>> Collections.EMPTY_LIST,
>>>> Collections.EMPTY_LIST);
>>>>
>>>> - Tore.
>>>>
>>>> On Jun 7, 2010, at 09:27 , Tore Halset wrote:
>>>>
>>>>> Hello.
>>>>>
>>>>> I am deleting some rows via jdbc and want to update the cayenne
>>>>> stack with that information. After issuing
>>>>> ctxt.invalidateObjects(...) the cayenne objects for the deleted
>>>>> rows still have persistence state comitted. Is there a better
>>>>> trick than invalidateObjects(...)?
>>>>>
>>>>> - Tore.
>>>>
>>>>
>>>
>>>
>>
>
>
Re: delete via jdbc
Posted by Joe Baldwin <jf...@earthlink.net>.
Yes, that is our configuration. It sounds like your standard "weak reference" model is probably the most optimum with the web filter pattern.
On Jun 8, 2010, at 11:40 AM, Michael Gentry wrote:
> Are you using the Cayenne web filter pattern? (So that your
> DataContext is stored in your HttpSession.) If so, when you logout
> and invalidate the HttpSession, the DataContext stored inside it
> should be given the boot, too.
>
> mrg
>
>
> On Tue, Jun 8, 2010 at 11:15 AM, Joe Baldwin <jf...@earthlink.net> wrote:
>> Andrus,
>>
>> I read this post by you and am wondering should I initiate an "unregisterObjects" in the normal course of events, when say someone is logging out (in a webstore design pattern) to "suggest" memory management events, or is that superfluous and your "weak reference" algorithm is sufficient?
>>
>> Joe
>>
>>
>> On Jun 7, 2010, at 11:04 AM, Andrus Adamchik wrote:
>>
>>> Invalidate should hollow the objects, but keep their references in the context (they shouldn't resolve to committed though, so I am surprised about that).
>>>
>>> DataContext also has a method "unregisterObjects" (not a part of ObjectContext interface) that should forget about the objects in a given context, clear the shared cache, and send invalidate event to peer contexts.
>>>
>>> Andrus
>>>
>>>
>>> On Jun 7, 2010, at 7:58 AM, Tore Halset wrote:
>>>
>>>> Well, processSnapshotChanges did not solve the problem either. I am now doing deleteObjects() after deleting them via plain jdbc. It is not pretty, but works well as long as the objects are in state COMITTED.
>>>>
>>>> - Tore.
>>>>
>>>> On Jun 7, 2010, at 12:27, Tore Halset wrote:
>>>>
>>>>> Hello.
>>>>>
>>>>> This one seem to work much better.
>>>>>
>>>>> ((DataContext) ctxt).getObjectStore().getDataRowCache().processSnapshotChanges(this,
>>>>> Collections.EMPTY_MAP, deletedIds, Collections.EMPTY_LIST,
>>>>> Collections.EMPTY_LIST);
>>>>>
>>>>> - Tore.
>>>>>
>>>>> On Jun 7, 2010, at 09:27 , Tore Halset wrote:
>>>>>
>>>>>> Hello.
>>>>>>
>>>>>> I am deleting some rows via jdbc and want to update the cayenne stack with that information. After issuing ctxt.invalidateObjects(...) the cayenne objects for the deleted rows still have persistence state comitted. Is there a better trick than invalidateObjects(...)?
>>>>>>
>>>>>> - Tore.
>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
Re: delete via jdbc
Posted by Michael Gentry <mg...@masslight.net>.
Are you using the Cayenne web filter pattern? (So that your
DataContext is stored in your HttpSession.) If so, when you logout
and invalidate the HttpSession, the DataContext stored inside it
should be given the boot, too.
mrg
On Tue, Jun 8, 2010 at 11:15 AM, Joe Baldwin <jf...@earthlink.net> wrote:
> Andrus,
>
> I read this post by you and am wondering should I initiate an "unregisterObjects" in the normal course of events, when say someone is logging out (in a webstore design pattern) to "suggest" memory management events, or is that superfluous and your "weak reference" algorithm is sufficient?
>
> Joe
>
>
> On Jun 7, 2010, at 11:04 AM, Andrus Adamchik wrote:
>
>> Invalidate should hollow the objects, but keep their references in the context (they shouldn't resolve to committed though, so I am surprised about that).
>>
>> DataContext also has a method "unregisterObjects" (not a part of ObjectContext interface) that should forget about the objects in a given context, clear the shared cache, and send invalidate event to peer contexts.
>>
>> Andrus
>>
>>
>> On Jun 7, 2010, at 7:58 AM, Tore Halset wrote:
>>
>>> Well, processSnapshotChanges did not solve the problem either. I am now doing deleteObjects() after deleting them via plain jdbc. It is not pretty, but works well as long as the objects are in state COMITTED.
>>>
>>> - Tore.
>>>
>>> On Jun 7, 2010, at 12:27, Tore Halset wrote:
>>>
>>>> Hello.
>>>>
>>>> This one seem to work much better.
>>>>
>>>> ((DataContext) ctxt).getObjectStore().getDataRowCache().processSnapshotChanges(this,
>>>> Collections.EMPTY_MAP, deletedIds, Collections.EMPTY_LIST,
>>>> Collections.EMPTY_LIST);
>>>>
>>>> - Tore.
>>>>
>>>> On Jun 7, 2010, at 09:27 , Tore Halset wrote:
>>>>
>>>>> Hello.
>>>>>
>>>>> I am deleting some rows via jdbc and want to update the cayenne stack with that information. After issuing ctxt.invalidateObjects(...) the cayenne objects for the deleted rows still have persistence state comitted. Is there a better trick than invalidateObjects(...)?
>>>>>
>>>>> - Tore.
>>>>
>>>>
>>>
>>>
>>
>
>
Re: delete via jdbc
Posted by Joe Baldwin <jf...@earthlink.net>.
Andrus,
I read this post by you and am wondering should I initiate an "unregisterObjects" in the normal course of events, when say someone is logging out (in a webstore design pattern) to "suggest" memory management events, or is that superfluous and your "weak reference" algorithm is sufficient?
Joe
On Jun 7, 2010, at 11:04 AM, Andrus Adamchik wrote:
> Invalidate should hollow the objects, but keep their references in the context (they shouldn't resolve to committed though, so I am surprised about that).
>
> DataContext also has a method "unregisterObjects" (not a part of ObjectContext interface) that should forget about the objects in a given context, clear the shared cache, and send invalidate event to peer contexts.
>
> Andrus
>
>
> On Jun 7, 2010, at 7:58 AM, Tore Halset wrote:
>
>> Well, processSnapshotChanges did not solve the problem either. I am now doing deleteObjects() after deleting them via plain jdbc. It is not pretty, but works well as long as the objects are in state COMITTED.
>>
>> - Tore.
>>
>> On Jun 7, 2010, at 12:27, Tore Halset wrote:
>>
>>> Hello.
>>>
>>> This one seem to work much better.
>>>
>>> ((DataContext) ctxt).getObjectStore().getDataRowCache().processSnapshotChanges(this,
>>> Collections.EMPTY_MAP, deletedIds, Collections.EMPTY_LIST,
>>> Collections.EMPTY_LIST);
>>>
>>> - Tore.
>>>
>>> On Jun 7, 2010, at 09:27 , Tore Halset wrote:
>>>
>>>> Hello.
>>>>
>>>> I am deleting some rows via jdbc and want to update the cayenne stack with that information. After issuing ctxt.invalidateObjects(...) the cayenne objects for the deleted rows still have persistence state comitted. Is there a better trick than invalidateObjects(...)?
>>>>
>>>> - Tore.
>>>
>>>
>>
>>
>
Re: delete via jdbc
Posted by Andrus Adamchik <an...@objectstyle.org>.
Invalidate should hollow the objects, but keep their references in the
context (they shouldn't resolve to committed though, so I am surprised
about that).
DataContext also has a method "unregisterObjects" (not a part of
ObjectContext interface) that should forget about the objects in a
given context, clear the shared cache, and send invalidate event to
peer contexts.
Andrus
On Jun 7, 2010, at 7:58 AM, Tore Halset wrote:
> Well, processSnapshotChanges did not solve the problem either. I am
> now doing deleteObjects() after deleting them via plain jdbc. It is
> not pretty, but works well as long as the objects are in state
> COMITTED.
>
> - Tore.
>
> On Jun 7, 2010, at 12:27, Tore Halset wrote:
>
>> Hello.
>>
>> This one seem to work much better.
>>
>> ((DataContext)
>> ctxt).getObjectStore().getDataRowCache().processSnapshotChanges(this,
>> Collections.EMPTY_MAP, deletedIds,
>> Collections.EMPTY_LIST,
>> Collections.EMPTY_LIST);
>>
>> - Tore.
>>
>> On Jun 7, 2010, at 09:27 , Tore Halset wrote:
>>
>>> Hello.
>>>
>>> I am deleting some rows via jdbc and want to update the cayenne
>>> stack with that information. After issuing
>>> ctxt.invalidateObjects(...) the cayenne objects for the deleted
>>> rows still have persistence state comitted. Is there a better
>>> trick than invalidateObjects(...)?
>>>
>>> - Tore.
>>
>>
>
>
Re: delete via jdbc
Posted by Tore Halset <ha...@pvv.ntnu.no>.
Well, processSnapshotChanges did not solve the problem either. I am now doing deleteObjects() after deleting them via plain jdbc. It is not pretty, but works well as long as the objects are in state COMITTED.
- Tore.
On Jun 7, 2010, at 12:27, Tore Halset wrote:
> Hello.
>
> This one seem to work much better.
>
> ((DataContext) ctxt).getObjectStore().getDataRowCache().processSnapshotChanges(this,
> Collections.EMPTY_MAP, deletedIds, Collections.EMPTY_LIST,
> Collections.EMPTY_LIST);
>
> - Tore.
>
> On Jun 7, 2010, at 09:27 , Tore Halset wrote:
>
>> Hello.
>>
>> I am deleting some rows via jdbc and want to update the cayenne stack with that information. After issuing ctxt.invalidateObjects(...) the cayenne objects for the deleted rows still have persistence state comitted. Is there a better trick than invalidateObjects(...)?
>>
>> - Tore.
>
>
Re: delete via jdbc
Posted by Tore Halset <ha...@pvv.ntnu.no>.
Hello.
This one seem to work much better.
((DataContext) ctxt).getObjectStore().getDataRowCache().processSnapshotChanges(this,
Collections.EMPTY_MAP, deletedIds, Collections.EMPTY_LIST,
Collections.EMPTY_LIST);
- Tore.
On Jun 7, 2010, at 09:27 , Tore Halset wrote:
> Hello.
>
> I am deleting some rows via jdbc and want to update the cayenne stack with that information. After issuing ctxt.invalidateObjects(...) the cayenne objects for the deleted rows still have persistence state comitted. Is there a better trick than invalidateObjects(...)?
>
> - Tore.