I would turn up logging on Hibernate and EhCache to see if the cache
is being used. You should be able to do this in your log4j file.

Matt

On Thu, Oct 8, 2009 at 2:01 AM, Nelson Biasura
<nelson.bias...@aurisoftsys.com> wrote:
> After configuring ehcache.xml adding my object (GroupProduct)
>
> Code: ehcache.xml
> ----------------------------------
> <ehcache>
>
>   <diskStore path="c:\\temp"/>
>
>   <defaultCache
>       maxElementsInMemory="10000"
>       eternal="false"
>       overflowToDisk="true"
>       timeToIdleSeconds="120"
>       timeToLiveSeconds="120"
>       diskPersistent="false"
>       diskExpiryThreadIntervalSeconds="120"/>
>      <!-- my new object to include in cache -->
>    <cache name="com.company.project.model.GroupProduct"
>       maxElementsInMemory="100000"
>       eternal="true"
>       overflowToDisk="false"
>       />
> </ehcache>
> ----------------------------------
>
>
>
> Log the measure the milliseconds load in DaoHibernate:
>
> Code:  GroupProductDaoHibernate
> -----------------------------------
>   public List<GroupProduct> findByServiceId(String serviceId) {
>       Long serviceIdLong = Long.valueOf(serviceId);
>       List<GroupProduct> gpDTOList = new ArrayList<GroupProduct>();
>
>       long a = System.currentTimeMillis();
>       log.debug("start time -  DAO: " + a);
>
>       gpDTOList = getHibernateTemplate().find("from GroupProduct gp where
> gp.version=0 and gp.serviceID=" + serviceIdLong);
>
>       long b = System.currentTimeMillis();
>       log.debug("Execution time - DAO: " + (b - a) + " ms");
>             return gpDTOList;
>   }
> ---------------------------------------
>
> I got almost the same result in loading
>
> Before:
> 9453 ms
> 8688 ms
> 9434 ms
>
> After:
> 8492 ms
> 9000 ms
> 8239 ms
>
>
> I am missing something here? is there something i need to tweak or
> configure/add etc.. To
> get going on second level cache..
>
> Thanks
>
>
>
>
>
>
>
> Matt Raible wrote:
>>
>> I believe adding the object into ehcache.xml is enough, but you might
>> want to check EhCache/Hibernate documentation to be sure.
>>
>> Matt
>>
>> On Wed, Oct 7, 2009 at 10:15 AM, Nelson Biasura
>> <nelson.bias...@aurisoftsys.com> wrote:
>>
>>>
>>> Thanks for the clarification Matt. Another thing do i still need to add
>>> @Cache annotation in the object that
>>> i want to be cache or adding the object into ehcache.xml is enough that i
>>> dont need to configure anything anymore
>>> and ready for second level caching?
>>>
>>> Thanks for letting me understand.
>>>
>>>
>>> Matt Raible wrote:
>>>
>>>>
>>>> No, you should not need to do anything additional - EhCache is enabled
>>>> by default. You might want to modify ehcache.xml to configure which
>>>> objects to cache though.
>>>>
>>>> Matt
>>>>
>>>> On Wed, Oct 7, 2009 at 7:28 AM, Nelson Biasura
>>>> <nelson.bias...@aurisoftsys.com> wrote:
>>>>
>>>>
>>>>>
>>>>> Hello,
>>>>>
>>>>> Im using Appfuse 2.0.2 and I trying to configure second level cache, I
>>>>> found
>>>>> article written by matt
>>>>> that leads me to this link
>>>>>  http://www.devx.com/dbzone/Article/29685/0/page/2  .. In this example
>>>>> it
>>>>> activated
>>>>> the second level caching through hibernate.cfg.xml adding this code
>>>>>
>>>>> |<property name="hibernate.cache.provider_class">
>>>>>                      org.hibernate.cache.EHCacheProvider
>>>>> </property>
>>>>>
>>>>> My question is do i still need to do this? i found in
>>>>> applicationContext-dao.xml
>>>>>
>>>>> <property name="hibernateProperties">
>>>>>         <value>
>>>>>             hibernate.dialect=${hibernate.dialect}
>>>>>             hibernate.query.substitutions=true 'Y', false 'N'
>>>>>             hibernate.cache.use_second_level_cache=true
>>>>>
>>>>> hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
>>>>>         </value>
>>>>>         <!-- Turn batching off for better error messages under
>>>>> PostgreSQL
>>>>> -->
>>>>>         <!-- hibernate.jdbc.batch_size=0 -->
>>>>>  </property>
>>>>>
>>>>> I assumed that this activate my second-level of caching. Anyone could
>>>>> help
>>>>> clarify it?
>>>>>
>>>>> Thanks in advance. :)
>>>>> |
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
>>>>> For additional commands, e-mail: users-h...@appfuse.dev.java.net
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
>>>> For additional commands, e-mail: users-h...@appfuse.dev.java.net
>>>>
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
>>> For additional commands, e-mail: users-h...@appfuse.dev.java.net
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
>> For additional commands, e-mail: users-h...@appfuse.dev.java.net
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
> For additional commands, e-mail: users-h...@appfuse.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to