[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3392) Query Cache entries are not distributable

Greg Luck (JIRA) noreply at atlassian.com
Mon Jul 21 19:44:12 EDT 2008


Query Cache entries are not distributable
-----------------------------------------

                 Key: HHH-3392
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3392
             Project: Hibernate3
          Issue Type: Bug
          Components: caching (L2)
    Affects Versions: 3.3.0.CR1
         Environment: Any
            Reporter: Greg Luck


Steve

It will correct the issue we saw.

On 17/06/2008, at 1:50 AM, Steve Ebersole wrote:

I'm asking for confirmation that said change does in fact correct the
issue :)

If it does I'll make the change in Hibernate...


On Mon, 2008-06-16 at 17:42 +1000, Greg Luck wrote:
Steve


Thanks. Why don't you make the change in Hibernate?

On 14/06/2008, at 2:40 PM, Steve Ebersole wrote:



Considering that RootEntityResultTransformer is not performing an
kind
of data uniqueing (singleton, etc) then yes that would be an issue.
There is nothing wrong with caching a query which uses a
ResultTransformer per-se.

As simple test would be to add an equals() override
to RootEntityResultTransformer where the class of the operands are
evaluated:
public boolean equals(Object other) {
  // all RootEntityResultTransformers are considered equal
  return other != null
&& RootEntityResultTransformer.class.isInstance( other ) 
}



On Tue, 2008-06-10 at 14:35 +1000, Greg Luck wrote:
Steve


I have a question from a Hibernate/Ehcache user.


When he replicates a cached Query it does not get hit on the
second
box. 


I can see what the trouble is: the key includes an object
reference to
a RootEntityResultTransformer:


; transformer:
org.hibernate.transform.RootEntityResultTransformer at a725aa,
value=[4968486262001664, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
version=1,
hitCount=0, CreationTime = 1213009341528, LastAccessTime = 0 ] 


So, this cannot work. How does this work for any distributed
cache?



Begin forwarded message:

From: alvins <alvins1982 at hotmail.com> 
Date: 9 June 2008 9:26:38 PM 
To: ehcache-list at lists.sourceforge.net 
Subject: [ehcache-list]  Distributed ehcache - queries 



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 at 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 at 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 at 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 at 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?
-- 
View this message in context:
http://www.nabble.com/Distributed-ehcache---queries-tp17730904p17730904.html
Sent from the Ehcache mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
ehcache-list mailing list
ehcache-list at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ehcache-list


Regards


Greg Luck



web: http://gregluck.com
skype: gregrluck
yahoo: gregrluck
mobile: +61 408 061 622









Regards


Greg Luck



web: http://gregluck.com
skype: gregrluck
yahoo: gregrluck
mobile: +61 408 061 622








Regards

Greg Luck

web: http://gregluck.com
skype: gregrluck
yahoo: gregrluck
mobile: +61 408 061 622




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list