[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2352) ClassCastException in Session.get()

Alexey Romanchuk (JIRA) noreply at atlassian.com
Wed Jan 10 04:20:44 EST 2007


ClassCastException in Session.get()
-----------------------------------

         Key: HHH-2352
         URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2352
     Project: Hibernate3
        Type: Bug

  Components: core  
    Versions: 3.2.1    
 Environment: Hibernate 3.2.1
    Reporter: Alexey Romanchuk
    Priority: Critical


We have inheritance with joined-subclass mapping. Imagine that we have parent class - BaseObject and two subclasses - Client and Item. We enable second level cache on BaseObject. 
try to load Client in first session 
Client client = ( Client ) s1.get( Client.class, 1851727l );
after this we have this client in second level cache.
Next - load another subclass with same id:
Item item = ( Item ) s2.get( Item.class, 1851727l );
and here we have ClassCastException because hibernate found BaseObject (Client) and return it instead of null.

The solution is class check in org.hibernate.event.def.DefaultLoadEventListener.loadFromSecondLevelCache() function. This is crititcal bug that violates Session API.


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