You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Gary Jarrel <ga...@gmail.com> on 2011/09/10 06:06:04 UTC

Some more on 3.1 Conversion

Hi All,

Still working with the new features and finding some really cool
stuff, but am running into a few problems here and there, probably
cause am used to the old ways:

I've got the following initialization code:

Module extensions = new Module() {
    @Override
    public void configure(Binder binder) {
        binder.bind(QueryCache.class).toProvider(OSQueryCacheProvider.class);
    }
};

serverRuntime = new ServerRuntime("cayenne-cdao.xml", extensions);
DataDomain domain = serverRuntime.getDataDomain();
DataNode node = domain.getNode("cdaoNode");
node.setDataSource(dataSource);
domain.setSharedCacheEnabled(true);

QueryCache cache = ((DataContext)serverRuntime.getContext()).getQueryCache();
int size = cache.size();

Running through a debugger I am finding that the cache object is an
instance of org.apache.cayenne.cache.QueryCacheLazyInitializationProxy
and it's provider is org.apache.cayenne.cache.MapQueryCacheProvider.

Shouldn't the provider in this instance be OSQueryCacheProvider?

Thank you

garyj

Re: Some more on 3.1 Conversion

Posted by Gary Jarrel <ga...@gmail.com>.
Thank you Andrus.

On Mon, Sep 12, 2011 at 7:46 PM, Andrus Adamchik <an...@objectstyle.org> wrote:
> Yeah, it turned to be redundant and was removed. You should bind directly to implementation class:
>
>   binder.bind(QueryCache.class).to(OSQueryCache.class);
>
> On Sep 12, 2011, at 12:35 PM, Gary Jarrel wrote:
>
>> I switched over to 3.1-SNAPSHOT from the repository and now the
>> OSQueryCacheProvider.class is missing!?
>>
>> How would I achieve the same cache setting in the latest source?!
>>
>> Gary
>>
>> On Mon, Sep 12, 2011 at 4:45 PM, Andrus Adamchik <an...@objectstyle.org> wrote:
>>> Actually take this back.. before I upgraded to the pre-M3 trunk build myself, the OS cache initialzation looked like this:
>>>
>>> runtime.getDataDomain().setQueryCacheFactory(new OSQueryCacheFactory());
>>>
>>> Andrus
>>>
>>> On Sep 12, 2011, at 9:39 AM, Andrus Adamchik wrote:
>>>
>>>> Good question. That same code works for me (just don't remember all the M2 initialization details). In the upcoming M3 per CAY-1537 [1] the whole QueryCacheLazyInitializationProxy is gone for good. So maybe try a source build from trunk?
>>>>
>>>> Andrus
>>>>
>>>> [1] https://issues.apache.org/jira/browse/CAY-1537
>>>>
>>>> On Sep 10, 2011, at 7:06 AM, Gary Jarrel wrote:
>>>>> Hi All,
>>>>>
>>>>> Still working with the new features and finding some really cool
>>>>> stuff, but am running into a few problems here and there, probably
>>>>> cause am used to the old ways:
>>>>>
>>>>> I've got the following initialization code:
>>>>>
>>>>> Module extensions = new Module() {
>>>>>   @Override
>>>>>   public void configure(Binder binder) {
>>>>>       binder.bind(QueryCache.class).toProvider(OSQueryCacheProvider.class);
>>>>>   }
>>>>> };
>>>>>
>>>>> serverRuntime = new ServerRuntime("cayenne-cdao.xml", extensions);
>>>>> DataDomain domain = serverRuntime.getDataDomain();
>>>>> DataNode node = domain.getNode("cdaoNode");
>>>>> node.setDataSource(dataSource);
>>>>> domain.setSharedCacheEnabled(true);
>>>>>
>>>>> QueryCache cache = ((DataContext)serverRuntime.getContext()).getQueryCache();
>>>>> int size = cache.size();
>>>>>
>>>>> Running through a debugger I am finding that the cache object is an
>>>>> instance of org.apache.cayenne.cache.QueryCacheLazyInitializationProxy
>>>>> and it's provider is org.apache.cayenne.cache.MapQueryCacheProvider.
>>>>>
>>>>> Shouldn't the provider in this instance be OSQueryCacheProvider?
>>>>>
>>>>> Thank you
>>>>>
>>>>> garyj
>>>>>
>>>>
>>>>
>>>
>>>
>>
>
>

Re: Some more on 3.1 Conversion

Posted by Andrus Adamchik <an...@objectstyle.org>.
Yeah, it turned to be redundant and was removed. You should bind directly to implementation class:

   binder.bind(QueryCache.class).to(OSQueryCache.class);

On Sep 12, 2011, at 12:35 PM, Gary Jarrel wrote:

> I switched over to 3.1-SNAPSHOT from the repository and now the
> OSQueryCacheProvider.class is missing!?
> 
> How would I achieve the same cache setting in the latest source?!
> 
> Gary
> 
> On Mon, Sep 12, 2011 at 4:45 PM, Andrus Adamchik <an...@objectstyle.org> wrote:
>> Actually take this back.. before I upgraded to the pre-M3 trunk build myself, the OS cache initialzation looked like this:
>> 
>> runtime.getDataDomain().setQueryCacheFactory(new OSQueryCacheFactory());
>> 
>> Andrus
>> 
>> On Sep 12, 2011, at 9:39 AM, Andrus Adamchik wrote:
>> 
>>> Good question. That same code works for me (just don't remember all the M2 initialization details). In the upcoming M3 per CAY-1537 [1] the whole QueryCacheLazyInitializationProxy is gone for good. So maybe try a source build from trunk?
>>> 
>>> Andrus
>>> 
>>> [1] https://issues.apache.org/jira/browse/CAY-1537
>>> 
>>> On Sep 10, 2011, at 7:06 AM, Gary Jarrel wrote:
>>>> Hi All,
>>>> 
>>>> Still working with the new features and finding some really cool
>>>> stuff, but am running into a few problems here and there, probably
>>>> cause am used to the old ways:
>>>> 
>>>> I've got the following initialization code:
>>>> 
>>>> Module extensions = new Module() {
>>>>   @Override
>>>>   public void configure(Binder binder) {
>>>>       binder.bind(QueryCache.class).toProvider(OSQueryCacheProvider.class);
>>>>   }
>>>> };
>>>> 
>>>> serverRuntime = new ServerRuntime("cayenne-cdao.xml", extensions);
>>>> DataDomain domain = serverRuntime.getDataDomain();
>>>> DataNode node = domain.getNode("cdaoNode");
>>>> node.setDataSource(dataSource);
>>>> domain.setSharedCacheEnabled(true);
>>>> 
>>>> QueryCache cache = ((DataContext)serverRuntime.getContext()).getQueryCache();
>>>> int size = cache.size();
>>>> 
>>>> Running through a debugger I am finding that the cache object is an
>>>> instance of org.apache.cayenne.cache.QueryCacheLazyInitializationProxy
>>>> and it's provider is org.apache.cayenne.cache.MapQueryCacheProvider.
>>>> 
>>>> Shouldn't the provider in this instance be OSQueryCacheProvider?
>>>> 
>>>> Thank you
>>>> 
>>>> garyj
>>>> 
>>> 
>>> 
>> 
>> 
> 


Re: Some more on 3.1 Conversion

Posted by Gary Jarrel <ga...@gmail.com>.
I switched over to 3.1-SNAPSHOT from the repository and now the
OSQueryCacheProvider.class is missing!?

How would I achieve the same cache setting in the latest source?!

Gary

On Mon, Sep 12, 2011 at 4:45 PM, Andrus Adamchik <an...@objectstyle.org> wrote:
> Actually take this back.. before I upgraded to the pre-M3 trunk build myself, the OS cache initialzation looked like this:
>
> runtime.getDataDomain().setQueryCacheFactory(new OSQueryCacheFactory());
>
> Andrus
>
> On Sep 12, 2011, at 9:39 AM, Andrus Adamchik wrote:
>
>> Good question. That same code works for me (just don't remember all the M2 initialization details). In the upcoming M3 per CAY-1537 [1] the whole QueryCacheLazyInitializationProxy is gone for good. So maybe try a source build from trunk?
>>
>> Andrus
>>
>> [1] https://issues.apache.org/jira/browse/CAY-1537
>>
>> On Sep 10, 2011, at 7:06 AM, Gary Jarrel wrote:
>>> Hi All,
>>>
>>> Still working with the new features and finding some really cool
>>> stuff, but am running into a few problems here and there, probably
>>> cause am used to the old ways:
>>>
>>> I've got the following initialization code:
>>>
>>> Module extensions = new Module() {
>>>   @Override
>>>   public void configure(Binder binder) {
>>>       binder.bind(QueryCache.class).toProvider(OSQueryCacheProvider.class);
>>>   }
>>> };
>>>
>>> serverRuntime = new ServerRuntime("cayenne-cdao.xml", extensions);
>>> DataDomain domain = serverRuntime.getDataDomain();
>>> DataNode node = domain.getNode("cdaoNode");
>>> node.setDataSource(dataSource);
>>> domain.setSharedCacheEnabled(true);
>>>
>>> QueryCache cache = ((DataContext)serverRuntime.getContext()).getQueryCache();
>>> int size = cache.size();
>>>
>>> Running through a debugger I am finding that the cache object is an
>>> instance of org.apache.cayenne.cache.QueryCacheLazyInitializationProxy
>>> and it's provider is org.apache.cayenne.cache.MapQueryCacheProvider.
>>>
>>> Shouldn't the provider in this instance be OSQueryCacheProvider?
>>>
>>> Thank you
>>>
>>> garyj
>>>
>>
>>
>
>

Re: Some more on 3.1 Conversion

Posted by Andrus Adamchik <an...@objectstyle.org>.
Actually take this back.. before I upgraded to the pre-M3 trunk build myself, the OS cache initialzation looked like this:

runtime.getDataDomain().setQueryCacheFactory(new OSQueryCacheFactory());

Andrus

On Sep 12, 2011, at 9:39 AM, Andrus Adamchik wrote:

> Good question. That same code works for me (just don't remember all the M2 initialization details). In the upcoming M3 per CAY-1537 [1] the whole QueryCacheLazyInitializationProxy is gone for good. So maybe try a source build from trunk?
> 
> Andrus
> 
> [1] https://issues.apache.org/jira/browse/CAY-1537
> 
> On Sep 10, 2011, at 7:06 AM, Gary Jarrel wrote:
>> Hi All,
>> 
>> Still working with the new features and finding some really cool
>> stuff, but am running into a few problems here and there, probably
>> cause am used to the old ways:
>> 
>> I've got the following initialization code:
>> 
>> Module extensions = new Module() {
>>   @Override
>>   public void configure(Binder binder) {
>>       binder.bind(QueryCache.class).toProvider(OSQueryCacheProvider.class);
>>   }
>> };
>> 
>> serverRuntime = new ServerRuntime("cayenne-cdao.xml", extensions);
>> DataDomain domain = serverRuntime.getDataDomain();
>> DataNode node = domain.getNode("cdaoNode");
>> node.setDataSource(dataSource);
>> domain.setSharedCacheEnabled(true);
>> 
>> QueryCache cache = ((DataContext)serverRuntime.getContext()).getQueryCache();
>> int size = cache.size();
>> 
>> Running through a debugger I am finding that the cache object is an
>> instance of org.apache.cayenne.cache.QueryCacheLazyInitializationProxy
>> and it's provider is org.apache.cayenne.cache.MapQueryCacheProvider.
>> 
>> Shouldn't the provider in this instance be OSQueryCacheProvider?
>> 
>> Thank you
>> 
>> garyj
>> 
> 
> 


Re: Some more on 3.1 Conversion

Posted by Andrus Adamchik <an...@objectstyle.org>.
Good question. That same code works for me (just don't remember all the M2 initialization details). In the upcoming M3 per CAY-1537 [1] the whole QueryCacheLazyInitializationProxy is gone for good. So maybe try a source build from trunk?

Andrus

[1] https://issues.apache.org/jira/browse/CAY-1537

On Sep 10, 2011, at 7:06 AM, Gary Jarrel wrote:
> Hi All,
> 
> Still working with the new features and finding some really cool
> stuff, but am running into a few problems here and there, probably
> cause am used to the old ways:
> 
> I've got the following initialization code:
> 
> Module extensions = new Module() {
>    @Override
>    public void configure(Binder binder) {
>        binder.bind(QueryCache.class).toProvider(OSQueryCacheProvider.class);
>    }
> };
> 
> serverRuntime = new ServerRuntime("cayenne-cdao.xml", extensions);
> DataDomain domain = serverRuntime.getDataDomain();
> DataNode node = domain.getNode("cdaoNode");
> node.setDataSource(dataSource);
> domain.setSharedCacheEnabled(true);
> 
> QueryCache cache = ((DataContext)serverRuntime.getContext()).getQueryCache();
> int size = cache.size();
> 
> Running through a debugger I am finding that the cache object is an
> instance of org.apache.cayenne.cache.QueryCacheLazyInitializationProxy
> and it's provider is org.apache.cayenne.cache.MapQueryCacheProvider.
> 
> Shouldn't the provider in this instance be OSQueryCacheProvider?
> 
> Thank you
> 
> garyj
>