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

Emmanuel Bernard (JIRA) noreply at atlassian.com
Wed Jan 10 09:22:44 EST 2007


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2352?page=all ]
     
Emmanuel Bernard resolved HHH-2352:
-----------------------------------

    Resolution: Rejected

We discussed that in the past , and I think we decided that this is not an API violation. You are doing a CCE error becuase there is no Item having this id (since a client has this id already). If you are unsure of the type, use a query

> 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