[
http://jira.jboss.com/jira/browse/JBSEAM-2418?page=comments#action_12393158 ]
Pete Muir commented on JBSEAM-2418:
-----------------------------------
Are you able to attach an example to allow us to reproduce this?
Cannot use non-POJO Hibernate entities with Seam-managed Session
----------------------------------------------------------------
Key: JBSEAM-2418
URL:
http://jira.jboss.com/jira/browse/JBSEAM-2418
Project: JBoss Seam
Issue Type: Bug
Affects Versions: 2.0.0.GA
Environment: WinXP, JBoss4.2
Reporter: Dave Sunerton-Burl
When trying to use the Map-based mode of a Hibernate session, I get the error below.
First, here's the code that causes the error...
final Session session = (Session) Component.getInstance("dynamicSession");
final Session mapSession = session.getSession(EntityMode.MAP);
final Map record = (Map) mapSession.get("TestEntity", 10001l);
...the last line causes...
java.lang.AssertionError: java.lang.IllegalArgumentException: Not an entity class:
java.util.HashMap
at org.jboss.seam.mock.BaseSeamTest$Request.onException(BaseSeamTest.java:475)
at org.jboss.seam.mock.BaseSeamTest$Request$2.doFilter(BaseSeamTest.java:526)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
at org.jboss.seam.mock.BaseSeamTest$Request.run(BaseSeamTest.java:514)
at
com.fugro.traxx.entities.DynamicEntityTest.changeMappingsAtRuntime(DynamicEntityTest.java:88)
Caused by: java.lang.IllegalArgumentException: Not an entity class: java.util.HashMap
at org.jboss.seam.Entity.forClass(Entity.java:208)
at
org.jboss.seam.persistence.PersistenceProvider.getPostLoadMethod(PersistenceProvider.java:154)
at org.jboss.seam.security.Identity.checkEntityPermission(Identity.java:678)
at
org.jboss.seam.security.HibernateSecurityInterceptor.onLoad(HibernateSecurityInterceptor.java:35)
at
org.hibernate.event.def.DefaultPreLoadEventListener.onPreLoad(DefaultPreLoadEventListener.java:18)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:125)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
at org.hibernate.loader.Loader.doQuery(Loader.java:717)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1851)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)
at
org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:2992)
at
org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:395)
at
org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:375)
at
org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:139)
at
org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:195)
at
org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)
at
com.fugro.traxx.entities.DynamicEntityTest$3.invokeApplication(DynamicEntityTest.java:104)
at
org.jboss.seam.mock.BaseSeamTest$Request.invokeApplicationPhase(BaseSeamTest.java:652)
at org.jboss.seam.mock.BaseSeamTest$Request.emulateJsfLifecycle(BaseSeamTest.java:598)
at org.jboss.seam.mock.BaseSeamTest$Request.access$300(BaseSeamTest.java:185)
at org.jboss.seam.mock.BaseSeamTest$Request$2.doFilter(BaseSeamTest.java:519)
... 40 more
... Removed 22 stack frames
"dynamicSession" is declared in components.xml as...
<persistence:managed-hibernate-session auto-create="true"
name="dynamicSession"/>
The error seems to be connected to the HibernateSecurityInterceptor, which tries to get
hold of a real class from the mapping (which doesn't exist - this is a non-POJO
mapping). My workaround involved replacing the
"org.jboss.seam.persistence.HibernateSessionFactory" with my own implementation
which didn't add the interceptor (I will have to do without declarative security on
the dynamic entities).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira