-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Distributed ehcache - queries
PostPosted: Mon Jun 09, 2008 7:33 am 
Newbie

Joined: Thu Mar 20, 2008 1:27 am
Posts: 5
I am having some problems with ehcache in distributed mode and queries. I have a simple spring+hibernate+ehcache webapp running on two tomcat servers. I have enabled second level caching and I can see my simple pojo gets replicated back and forth fine between the two servers.

The query caching seems to work fine if I have a single server started. I can see that is using the cached query and not hitting the db. However what I am trying to test is if I have two boxes - box1 does query and populates cache which gets replicated to box2 - then box2 doesn't need to do query since its in cache.

My problem is that the query from box1 is not recognized as being the same as on box2 - it seems to get cached multiple times. Below is a log snippet of the two objects which are in my query cache - there should only be one. The first debug line is showing a query object which was replicated over from another box - the second line is showing a query object which was populated locally. This should not happen since they are the same query.

21:03:39,763 DEBUG net.sf.ehcache.store.MemoryStore - findTopXCache: findTopXMemoryStore hit for sql: select this_.emp_id as emp1_2_0_, this_.emp_firstname as emp2_2_0_, this_.emp_surname as emp3_2_0_ from Employee this_; parameters: ; first row: 0; max rows: 10; transformer: org.hibernate.transform.RootEntityResultTransformer@a725aa
LOCAL: [ key = sql: select this_.emp_id as emp1_2_0_, this_.emp_firstname as emp2_2_0_, this_.emp_surname as emp3_2_0_ from Employee this_; parameters: ; first row: 0; max rows: 10; transformer: org.hibernate.transform.RootEntityResultTransformer@a725aa, value=[4968486262001664, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], version=1, hitCount=0, CreationTime = 1213009341528, LastAccessTime = 0 ]
21:03:39,763 DEBUG net.sf.ehcache.store.MemoryStore - findTopXCache: findTopXMemoryStore hit for sql: select this_.emp_id as emp1_2_0_, this_.emp_firstname as emp2_2_0_, this_.emp_surname as emp3_2_0_ from Employee this_; parameters: ; first row: 0; max rows: 10; transformer: org.hibernate.transform.RootEntityResultTransformer@aa11a6
LOCAL: [ key = sql: select this_.emp_id as emp1_2_0_, this_.emp_firstname as emp2_2_0_, this_.emp_surname as emp3_2_0_ from Employee this_; parameters: ; first row: 0; max rows: 10; transformer: org.hibernate.transform.RootEntityResultTransformer@aa11a6, value=[4968486194896896, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], version=1, hitCount=5, CreationTime = 1213009325003, LastAccessTime = 1213009415332 ]

Does anybody have any ideas?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.