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
|
|