Hi,
I get my Company from the Hibernate Session though a get() call successfully. I store this in my HttpSession and upon the next request I call load(myCompany, myCompany.getId()) to reassociate it with the new Hibernate session. I get the exception as shown below though.
It seems as if the proxy gets retrieved and stored in the HttpSession and Hibernate doesn't know what to do with it upon the load. First off, this seems strange to me. A load() call with the proxy as an argument should just work right?
Secondly, I tried making sure my Company was completely loaded before storing it in my HttpSession by calling get(Company, myCompany.getId()). I still get the same exception.
When I set lazy="false" in my Company mapping file, it works fine. But obviously I don't want to always load all Companies to just solve this one problem. Do I misunderstand how Hibernate should work or am I doing something wrong?
Thank you for your help,
Joost Schouten
-----The exception ----------
org.hibernate.MappingException: Unknown entity: com.jsportal.buisinessadmin.beans.Company$$EnhancerByCGLIB$$dc673e43
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:548)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1338)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:64)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
at org.hibernate.impl.SessionImpl.load(SessionImpl.java:784)
at com.jsportal.buisinessadmin.transactionManagement.HibernateResource.load(HibernateResource.java:185)
at com.jsportal.buisinessadmin.web.JSFaces.Logon.init(Logon.java:337)
... 45 more
_________________ Joost Schouten
JS Portal
|