[hibernate-issues] [Hibernate-JIRA] Resolved: (HHH-2882) QueryKey.equals() returning false with distributed caching
Diego Plentz (JIRA)
noreply at atlassian.com
Tue May 5 10:15:17 EDT 2009
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2882?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Diego Plentz resolved HHH-2882.
-------------------------------
Resolution: Duplicate
Assignee: Diego Plentz
> QueryKey.equals() returning false with distributed caching
> ----------------------------------------------------------
>
> Key: HHH-2882
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2882
> Project: Hibernate Core
> Issue Type: Bug
> Components: query-criteria
> Affects Versions: 3.2.5
> Reporter: Daniel Campagnoli
> Assignee: Diego Plentz
>
> We noticed some issues recently with the query cache when using Coherence as the cache provider. This was due to instances of org.hibernate.cache.QueryKey not being equal after being serialized then deserialized.
> The equals check was failing on the [ResultTransformer customTransformer] field which in our case had an instance of RootEntityResultTransformer (which comes from the field CriteriaSpecification.ROOT_ENTITY). This is because RootEntityResultTransformer doesnt override equals, so the check is done by reference equality. When the QueryKey has been serialized and deserialized out of the cache, the instance will always be different, so the equals check will fail.
> A fix for this to be implement equals for RootEntityResultTransformer (and possibly the other ResultTransformer's). I used the following which worked fine.
> public boolean equals(Object obj) {
> return obj != null && this.getClass() == obj.getClass();
> }
> ps. I created HHH-1665 a while ago, a real simple fix, could that be looked at :)
--
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