You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by "Lachlan Deck (JIRA)" <de...@cayenne.apache.org> on 2007/06/05 09:40:28 UTC
[JIRA] Created: (CAY-797) Lifecycle callbacks *CallbackInterceptor
concept introduces problems for testing equality of contexts
Lifecycle callbacks *CallbackInterceptor concept introduces problems for testing equality of contexts
-----------------------------------------------------------------------------------------------------
Key: CAY-797
URL: https://issues.apache.org/cayenne/browse/CAY-797
Project: Cayenne
Issue Type: Bug
Components: Cayenne Core Library
Affects Versions: 3.0
Environment: 3.0-prerelease svn 523667
Reporter: Lachlan Deck
Assignee: Andrus Adamchik
Say you create a callback intercepted context as described here (http://cayenne.apache.org/doc/lifecycle-callbacks.html), or as in my case created a subclass of ObjectContextCallbackInterceptor to wrap these concepts.
ObjectContext myContext = new CallbackInterceptedContext();
Object a = myContext.newObject(SomeClass.class);
Object b = myContext.newObject(SomeClass.class);
myContext.equals( a.getObjectContext() ); // false (unless I override equals to provide a better test)
a.getObjectContext().equals( myContext ); // false
a.getObjectContext() == myContext; // false
a.getObjectContext().equals( b.getObjectContext() ); // true
So this gets a little messy having to essentially test in the correct direction. Now, I understand why this occurs (because the CallbackIntercepting essentially provides a proxy context for the context it contains) but it seems to me that this leads to some difficulties like the above that could possibly be more easily overcome were both DataContext and CayenneContext to implement callback intercepting directly.
Thoughts?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
Re: [JIRA] Created: (CAY-797) Lifecycle callbacks *CallbackInterceptor concept introduces problems for testing equality of contexts
Posted by Lachlan Deck <la...@gmail.com>.
Great.
On 05/06/2007, at 6:39 PM, Andrus Adamchik wrote:
> Yeah, I am leaning towards merging the callback code into the base
> context... The ability to proxy an ObjectContext is very nice, but
> it changes a few standard Cayenne assumptions about the object
> context. I guess for such fundamental functionality like callbacks,
> we shouldn't be doing that.
>
> Andrus
>
> On Jun 5, 2007, at 10:40 AM, Lachlan Deck (JIRA) wrote:
>
>> Lifecycle callbacks *CallbackInterceptor concept introduces
>> problems for testing equality of contexts
>> ---------------------------------------------------------------------
>> --------------------------------
>>
>> Key: CAY-797
>> URL: https://issues.apache.org/cayenne/browse/
>> CAY-797
>> Project: Cayenne
>> Issue Type: Bug
>> Components: Cayenne Core Library
>> Affects Versions: 3.0
>> Environment: 3.0-prerelease svn 523667
>> Reporter: Lachlan Deck
>> Assignee: Andrus Adamchik
>>
>>
>> Say you create a callback intercepted context as described here
>> (http://cayenne.apache.org/doc/lifecycle-callbacks.html), or as in
>> my case created a subclass of ObjectContextCallbackInterceptor to
>> wrap these concepts.
>>
>> ObjectContext myContext = new CallbackInterceptedContext();
>> Object a = myContext.newObject(SomeClass.class);
>> Object b = myContext.newObject(SomeClass.class);
>>
>> myContext.equals( a.getObjectContext() ); // false (unless I
>> override equals to provide a better test)
>> a.getObjectContext().equals( myContext ); // false
>> a.getObjectContext() == myContext; // false
>> a.getObjectContext().equals( b.getObjectContext() ); // true
>>
>> So this gets a little messy having to essentially test in the
>> correct direction. Now, I understand why this occurs (because the
>> CallbackIntercepting essentially provides a proxy context for the
>> context it contains) but it seems to me that this leads to some
>> difficulties like the above that could possibly be more easily
>> overcome were both DataContext and CayenneContext to implement
>> callback intercepting directly.
>>
>> Thoughts?
>>
>> --
>> This message is automatically generated by JIRA.
>> -
>> You can reply to this email to add a comment to the issue online.
with regards,
--
Lachlan Deck
Re: [JIRA] Created: (CAY-797) Lifecycle callbacks *CallbackInterceptor concept introduces problems for testing equality of contexts
Posted by Andrus Adamchik <an...@objectstyle.org>.
Yeah, I am leaning towards merging the callback code into the base
context... The ability to proxy an ObjectContext is very nice, but it
changes a few standard Cayenne assumptions about the object context.
I guess for such fundamental functionality like callbacks, we
shouldn't be doing that.
Andrus
On Jun 5, 2007, at 10:40 AM, Lachlan Deck (JIRA) wrote:
> Lifecycle callbacks *CallbackInterceptor concept introduces
> problems for testing equality of contexts
> ----------------------------------------------------------------------
> -------------------------------
>
> Key: CAY-797
> URL: https://issues.apache.org/cayenne/browse/CAY-797
> Project: Cayenne
> Issue Type: Bug
> Components: Cayenne Core Library
> Affects Versions: 3.0
> Environment: 3.0-prerelease svn 523667
> Reporter: Lachlan Deck
> Assignee: Andrus Adamchik
>
>
> Say you create a callback intercepted context as described here
> (http://cayenne.apache.org/doc/lifecycle-callbacks.html), or as in
> my case created a subclass of ObjectContextCallbackInterceptor to
> wrap these concepts.
>
> ObjectContext myContext = new CallbackInterceptedContext();
> Object a = myContext.newObject(SomeClass.class);
> Object b = myContext.newObject(SomeClass.class);
>
> myContext.equals( a.getObjectContext() ); // false (unless I
> override equals to provide a better test)
> a.getObjectContext().equals( myContext ); // false
> a.getObjectContext() == myContext; // false
> a.getObjectContext().equals( b.getObjectContext() ); // true
>
> So this gets a little messy having to essentially test in the
> correct direction. Now, I understand why this occurs (because the
> CallbackIntercepting essentially provides a proxy context for the
> context it contains) but it seems to me that this leads to some
> difficulties like the above that could possibly be more easily
> overcome were both DataContext and CayenneContext to implement
> callback intercepting directly.
>
> Thoughts?
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>