[hibernate-users] Cannot cast org.hibernate.classic.Session to org.hibernate.impl.SessionImpl

Halil Ağın halil.agin at gmail.com
Wed Jun 18 14:55:01 EDT 2008


Hello List;

I'm trying to implement the scenario explained at this site:
http://www.devx.com/Java/Article/30396/1763

At some place in the code,  there is such code below(In AbstractGeneriDao,
in generate member method ):

------------------------------------------------
(SessionImpl)getSession();
------------------------------------------------

Notes:
SessionImpl : org.hibernate.impl.SessionImpl
getSession : org.hibernate.classic.Session


I looked that SessionImpl class implements org.hibernate.classic.Session
interface, therefore the casting should work.
But when i run the application, there occure cast exception which says that
Cannot cast org.hibernate.classic.Session to org.hibernate.impl.SessionImpl.


Why this casting not working I could not understand. I think It should work,
because i am making a casting operation from an interface to its
implementation class.

Does anybody know why it does not work?

Regards,


-Halil AGIN
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-users/attachments/20080618/d50b4e5c/attachment.html 


More information about the hibernate-users mailing list