|
From: Mario I. <ma...@op...> - 2006-05-05 05:42:19
|
Hi! I already posted on the user list, but I looks like due to the massive posts it got lost. I took many time to think about this issue, and so I'll post it to your dev list as I'll eventually try to create a patch for it. 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. Thanks! Ciao, Mario |