|
Hi to everyone.
We tried to use hibernate second-level cache in grails 1.3.7. In our DataSource.groovy we put : cache.use_second_level_cache = true cache.use_query_cache = true cache.provider_class = 'net.sf.ehcache.hibernate.EhCacheProvider' we tried to change cache_provider_class to 'org.hibernate.cache.EhCacheProvider' but doesn't seems to work. In our queries we put the option cache:true and in the domain cache true. We don't know what we are doing wrong. Can anyone help us? or show us the path to follow? Thank you very much. José Manuel Moyano. www.finixer.com |
|
Hi Jose,
Not all retrieve methods supports cache. Take a look at: http://stackoverflow.com/questions/6413995/caching-domain-objects-in-grails Cheers, ACMattos. On 5/28/12, Jose Manuel Moyano <[hidden email]> wrote: > Hi to everyone. > > We tried to use hibernate second-level cache in grails 1.3.7. > In our DataSource.groovy we put : > > cache.use_second_level_cache = true > cache.use_query_cache = true > cache.provider_class = 'net.sf.ehcache.hibernate.EhCacheProvider' > > we tried to change cache_provider_class to > 'org.hibernate.cache.EhCacheProvider' but doesn't seems to work. > > In our queries we put the option cache:true and in the domain cache true. > > We don't know what we are doing wrong. > > Can anyone help us? or show us the path to follow? > > Thank you very much. > > José Manuel Moyano. > www.finixer.com > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Hi ACMattos. Thank you for your answer.
We try some examples, and when the argument for the search is a primitive (String, int, etc) the cache works perfectly. Some examples are: //def a = User.findByNickname('ab', [cache: true]) //def a = User.findAllByNickname('ab', [cache: true]) //def a = User.get(26) //def a = User.countByNickname('ab', [cache: true]) But when we try on objects, doesn't cache this query: //def photo2 = Pictures.findAllByUserAndType(user,PicturesConstants.USER_THUMBNAIL_CONTRIBUTION, [cache:true]), where user is an instance of User class. Domain Pictures has "cache true" in mapping definition and User too. User hasMany Pictures and we put the relation in cache too (in User mapping definition we put pictures cache:true) We don't know what are we doing wrong :((( Thank you everybody. 2012/5/28 ACMattos <[hidden email]> Hi Jose, |
|
Hi Jose,
Have you ever tryied something like: Pictures.findAllByUserIdAndType(user.Id,PicturesConstants.USER_THUMBNAIL_CONTRIBUTION, [cache:true]); I'm affraid that caching framework is trying to cache your query, but every request generates a new entry on cache. The effect is just what you can notice. No cache working. You can see Hibernate's cache using http://grails.org/plugin/app-info plugin. Cheers, ACMattos. On 5/29/12, Jose Manuel Moyano <[hidden email]> wrote: > Hi ACMattos. Thank you for your answer. > > We try some examples, and when the argument for the search is a primitive > (String, int, etc) the cache works perfectly. > Some examples are: > > //def a = User.findByNickname('ab', [cache: true]) > //def a = User.findAllByNickname('ab', [cache: true]) > //def a = User.get(26) > //def a = User.countByNickname('ab', [cache: true]) > > But when we try on objects, doesn't cache this query: > //def photo2 = > Pictures.findAllByUserAndType(user,PicturesConstants.USER_THUMBNAIL_CONTRIBUTION, > [cache:true]), where user is an instance of User class. > > Domain Pictures has "cache true" in mapping definition and User too. User > hasMany Pictures and we put the relation in cache too (in User mapping > definition we put pictures cache:true) > > We don't know what are we doing wrong :((( > > Thank you everybody. > > 2012/5/28 ACMattos <[hidden email]> > >> Hi Jose, >> >> Not all retrieve methods supports cache. Take a look at: >> http://stackoverflow.com/questions/6413995/caching-domain-objects-in-grails >> >> Cheers, >> >> ACMattos. >> >> On 5/28/12, Jose Manuel Moyano <[hidden email]> wrote: >> > Hi to everyone. >> > >> > We tried to use hibernate second-level cache in grails 1.3.7. >> > In our DataSource.groovy we put : >> > >> > cache.use_second_level_cache = true >> > cache.use_query_cache = true >> > cache.provider_class = 'net.sf.ehcache.hibernate.EhCacheProvider' >> > >> > we tried to change cache_provider_class to >> > 'org.hibernate.cache.EhCacheProvider' but doesn't seems to work. >> > >> > In our queries we put the option cache:true and in the domain cache >> > true. >> > >> > We don't know what we are doing wrong. >> > >> > Can anyone help us? or show us the path to follow? >> > >> > Thank you very much. >> > >> > José Manuel Moyano. >> > www.finixer.com >> > >> >> --------------------------------------------------------------------- >> To unsubscribe from this list, please visit: >> >> http://xircles.codehaus.org/manage_email >> >> >> > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Hi ACMattos.
We tried something like this and it works. We should use this solution. We know now one workaround to cache queries with objects. Thank you so much :) José Manuel.
2012/5/29 ACMattos <[hidden email]> Hi Jose, |
| Powered by Nabble | Edit this page |
