Hi,
I've tried to take advantage of the query cache on our application. Actually on a specific use case, the same query is run many times, and after a while there's good chance that this query has been run with all possible parameters .
The problem is that the query cache always misses. I think this is because the sole parameter is a user defined type which maps a Java byte array to an SQL VARCHAR.
In fact, the query cache uses a string representation of the query and its parameters as the key. Unfortunately, it simply calls the toString() method on the value field, hence getting the default toString() for a byte array.
This means that even if two byte array parameters are equal (Arrays.equals()), there will be a query cache miss, no matter if the same query with the same parameter value was executed before.
So, I wonder : Shouldn't the query key use the toString(Object value) method defined in NullableType rather the 'raw' toString() on the value ?
I'd like to know if I've completely lost it, or if this is a potential Hibernate bug.
Thanks,
Gregory
Hibernate version: 3.0.5
|