Yes, the API would be the same... 

But good point on usability. We had rather transparent API before, and then 
replaced it with what we have now :)

The reason for this change was to avoid storing context factory and any other 
stack singletons in an ObjectContext instance (be it DataContext or 
CayenneContext). As ObjectContext is serializable, having lots of extra 
"services" as ivars made bootstrapping it back to the stack on deserialization 
a rather painful operation. So in order to streamline that process, some of the 
earlier conveniences were sacrificed. 

If you think of CayenneRuntime as a "factory of everything" it may not look so 
confusing actually... Also maybe we can add a convenience method 
CayenneRuntime.getContext(ObjectContext) to avoid a cast. 

Also "getContext(DataChannel)" javadoc is mindlessly cloned from "getContext()" 
without explaining the difference and needs to be fixed :)

Andrus


On Jul 16, 2012, at 2:28 PM, Dzmitry Kazimirchyk wrote:

> What about next level of nesting...
> 
> ObjectContext nestedChild = runtime.getContext((DataChannel) 
> clientContextChild);
> 
> This approach doesn't seem handy or obvious. Is there a better way?
> 
> Dima
> 
> 
> On 07/16/2012 02:11 PM, Andrus Adamchik wrote:
>> The API was refactored, but the nested contexts feature is of course still 
>> present. Right now you'd create a client nested context using ClientRuntime:
>> 
>> ClientRuntime runtime = ..
>> ObjectContext clientContextChild = runtime.getContext(clientContext);
>> 
>> Andrus
>> 
>> On Jul 16, 2012, at 1:00 PM, Eshan Sudharaka wrote:
>> 
>>> Hi,
>>> I was trying to reproduce the issue CAY-1714 and it seems that following
>>> operation is now invalid. (since CayenneContext has mo such method
>>> declaration)
>>> 
>>> ObjectContext clientContext = this.clientContext.createChildContext();
>>> 
>>> So is this bug is fixed  now ?
>>> 
>>> -- 
>>> *~Thanks & Regards~*
>>> ***
>>> *
>>> Eshan
> 
> 
> 

Reply via email to