]
Guenther Demetz commented on HHH-4953:
--------------------------------------
The unique relation between this issue HHH-4953 and HHH-1134 in my humble opinion is the
post of HG added on 18/May/10 4:55 AM:
in fact his post describes actually HHH-4953 not HHH-1134.
HHH-1134 objects about querying and is in my opinion not a real bug because it get solved
by using the force discriminator option.
Inconsistent behavior when fetching cached subclass entities from 2L
--------------------------------------------------------------------
Key: HHH-4953
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4953
Project: Hibernate Core
Issue Type: Bug
Components: caching (L2)
Affects Versions: 3.2.5, 3.3.1, 3.5.0.Beta-1, 3.5.0-Beta-2, 3.5.0-Beta-3,
3.5.0-Beta-4, 3.5.0-CR-1, 3.5.0-CR-2
Environment: Hibernate3.5.0CR2,HSQLDB, EHCache as 2L-cache Impl
Reporter: Guenther Demetz
Attachments: Test2LCache.jar
Enabling the hibernate second-level cache is leading to inconsistent behavior when
fetching cached subclass entities as opposed to fetching non-cached subclass entities.
For more informations, please see
https://forum.hibernate.org/viewtopic.php?f=1&t=1002880&p=2425931...
Testcase attached.
Cause:
IMHO the bug consists in the fact, that
persister.getRootEntityName() instead to persister.getEntityName() is passed as 3thrd
parameter
to the constructor of CacheKey in most places where CacheKey is used, for example in
DefaultLoadEventListener.java:
new CacheKey(
event.getEntityId(),
persister.getIdentifierType(),
persister.getRootEntityName(),
source.getEntityMode(),
source.getFactory()
In this way the real entity name get swallowed and the type-saveness is not guaranteed
anymore.
Workaround:
Subclass2 tofind = null;
try {
tofind = (Subclass2) em.find(Subclass2.class,"identifier1");
}
catch (ClassCastException cc) {
// swallow , this is a workaround
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: