cache 2 « Query « JPA Q&A





1. How intelligent is the query Cache ?    forum.hibernate.org

Hi, I got some questions about the intelligence of the caching in Hibernate. Scenario: The following example is used as foundation to my questions: a) Query A contains criteria on attribute A b) Query B contains criteria on attribute A and B c) Query C contains criteria on attributes A, B, and C. Now imagine queries A, B and C are ...

2. Caching SQL query problem    forum.hibernate.org

3. ReadWrite Cache not finding an object on first read    forum.hibernate.org

Hibernate version:3.2.1 Ehcache version:1.2.3 Postgres 8.0.12 I have modified a set of persistent objects in my Hibernate-enabled application to use the READ_WRITE CacheConcurrencyStrategy. My objects consist of: User User.Container User.Container.Collection of XXX objects an XXX object is a graph of 8-10 other objects - all of which use the READ_WRITE annotation I'm seeing the following behavior: - On a create of ...

4. Weird behavior of the Query Cache    forum.hibernate.org

Newbie Joined: Wed Nov 07, 2007 7:05 am Posts: 2 Hi All, I am noticing some strange behavior when using the Query Cache .. The results of a query are cached in the first run and in the next run , I expect the results to be returned from the Cache, Instead I see multiple SQLs being generated ( one for ...

5. Query Based Caching with Joins    forum.hibernate.org

Hi , I have 3 tables (employee, department,allowances) where in all 3 are related. I have written a join query to retrieve data. Its running fine, till i implement query based caching on the specific query - meaning when i set the tag use_query_cache as true and call setCacheAble(true), that time the code breaks -- so can joins' results be query ...

6. Can queries having joins be query cached    forum.hibernate.org

Hi, I am new to hibernate and am trying to understand query based caching for queries using joins. In the hibernate docs and on community sites, I am unable to find a suitable example of running query based caching while using joins in queries. My question is can joins' results be query cached and if yes, can somebody please provide me ...

7. HQL query does not use second level cache    forum.hibernate.org

I have enabled second level cache for an entity. If I use entityManager.find to retrieve the entity by PK, the cache works (i.e. it hits the DB only the first time). But if I make a HQL query on this entity, it hits the DB every time... Here is the entity: Code: @Entity @Table(name = "CORE_MessageBuyerTranslation", uniqueConstraints = {}) @Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region="com.ibx.ibxrequest.model.CoreMessageBuyerTranslation") ...

8. Second level cache eternal and query cache living 120 sec.    forum.hibernate.org

Hibernate version: 3.2.4.sp1 (with JBoss 4.2.1) Hello, I'm using ehcache v.1.4.1 to enable query cache and second level cache in my app running on JBoss 4.2.1. The query cache is configure with that options : timeToIdleSeconds="120" and timeToLiveSeconds="120" And the second level caches are configured to be eternals (eternal=true) The caches hits work, all the queries are removed from the query ...

9. Enabling second level cache for find all queries    forum.hibernate.org

Hi For me the second level cache does'nt seem to work though have enabled it. The log for p6spy shows the queries fired everytime i need the object which ideally should have been picked up from the cache and no query should be hitting the database. Code : 1. Query query =dbSession.createSQLQuery(queryTable).addEntity(queryTable, classObj).setCacheable(true); 2. Also hibernate.properties has been enabled to activate ...





10. automatic query cache invalidation    forum.hibernate.org

11. Query Cache with Second Level Cache    forum.hibernate.org

Hibernate 3.x OSCache 2.1.3 Requirement: I am using Query Cache with Second level Cache and it has made things difficult. I am fetching values from a relatively static table. But when the new rows get added to this table, I need to fetch these new rows[inserted manually using sqlplus]. May be after the refresh period. Problem: Second Level Cache gets expired ...

12. Enable cache for read queries.    forum.hibernate.org

Hello, I have developed a website having registration and search functionality. User can search for a variety of a parameters. How can I use hibernate cache for data read queries. Ex: = ? and c.year <=?) and (c.height >= ? and c.height <=?) and c.gender = ? and enable='Y' ORDER BY lastLoginTime DESC) ]]> I am ...

13. HQL query does not use second level cache    forum.hibernate.org

I'm reiterating a post made at: http://forum.hibernate.org/viewtopic.php?p=2378569 since the responses were inadequate and the question exposes a real problem with hibernate's 2nd level cache. Post: ================ I have enabled second level cache for an entity. If I use entityManager.find to retrieve the entity by PK, the cache works (i.e. it hits the DB only the first time). But if I make ...

14. Query cache works with HQL but not with Criteria    forum.hibernate.org

select employment0_.id as id5_, employment0_.companyName as companyN2_5_, employment0_.since as since5_, employment0_.till as till5_ from ...

15. Query cache lifetime    forum.hibernate.org

16. PropertyAccessException when using Query Cache    forum.hibernate.org

Hi, I'm currently trying to migrate from Hibernate 3.2.6 to Hibernate 3.3.2 GA. However, whenever I try to query for objects with the query cache enabled I get an exception like the one shown below. When I disable the query cache it works fine. I get this with various criteria queries. As the stack trace shows, the exception happens calculating the ...





17. Query cache is not correctly work    forum.hibernate.org

User user = new User(); user.setAge(25); user.setName("Mark"); session.save(user); session.createQuery("FROM User u").setCacheable(true).list(); session.createQuery("FROM User u").setCacheable(true).list(); assertEquals(1, getSessionFactory().getStatistics().getQueryCacheHitCount()); ------------------------------------------------------------------------------------------- java.lang.AssertionError: expected:<1> but was:<0> I think that hibernate flush user object before every query(why???) and query cache invalidate. If i not insert user and execute only 2 queries - all ok (cache works). Any ideas? ---------------------------- User mapping: @Entity @Table(name = "user") @Cache(usage = ...

18. 2nd Level cache miss = N+1 Select    forum.hibernate.org