-->
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: serialized/deserialized criteria and query cache issue
PostPosted: Thu May 04, 2006 4:00 am 
Regular
Regular

Joined: Thu Dec 11, 2003 4:14 pm
Posts: 86
Location: Hibernate 3 + annotations, Oracle 9i, PostgreSQL 8.0, Java 1.5.0
Hibernate version:
3.2.0 rc1

A serialized/deserialized DetachedCriteria do not work correctly with the query cache.
The problem is the ResultTransformer in QueryKey.

In CriteraImpl the resultTransformer will be set to Criteria.ROOT_ENTITY.
This makes it down into the QueryKey.

After serialize/deserialize the instance of resultTransformer in CriteriaImpl has changed (not that a surprise ;-) ) and thus - in the end - the QueryKey changed.

Subsequent lookup in the query-cache will no longer work.
The query will be executed again and put int the query-cache.
The cache grows - every lookup failes.

I think every ResultTransformer used as singleton should implement some custom deserialization code so that always the same instance will be returned - this is one solution.

What solution do you prefer? Just in case I manage to send a patch.

Ciao,
Mario


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.