0 Replies Latest reply on Jun 19, 2007 5:38 PM by sysex

    Entity not Mapped with two datasources accessing EJBs outsid

    sysex

      Hi, I'm new to JBoss and Seam and have encountered a problem when trying to query Entity beans outside of my EAR.

      My environment consists of JBoss-4.0.5 running Seam-1.2.1.GA and Hibernate. My EAR deployment uses a MySQL database (which is connecting and working just fine) but also needs to query Entity beans, which also use Hibernate, and are deployed one level up (~/server/default/deploy) as two separate JAR archives (API and Impl). The JARs are able to communicate with Hibernate to create and import data into their OracleXE database but aren't accessible from my EAR.

      After having done some research I am not sure if the issue is related to Seam needing an explicit persistence-unit declaration to use for the query or whether there is an issue with the Entities needing to be published as a JMX service using jboss-app.xml so that the separate classloaders can communicate.

      I am writing the simplest query possible which throws the following exception:

      Caused by: org.hibernate.hql.ast.QuerySyntaxException: CollectionCategory is not mapped [select categoryCollection from CollectionCategory categoryCollection where categoryCollection.collectionCategoryId = :el1]
      at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:158)
      at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:87)
      at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:70)
      at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:265)
      at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3056)
      at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2945)
      at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
      at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544)
      at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
      at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
      at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
      at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
      at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
      at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:77)
      at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:56)
      at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
      at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
      at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
      at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
      at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:92)
      ... 85 more


      Is anyone able to elaborate on the mechanisms of communication between separate JBoss deployments and the accessibility of Hibernate mappings? As well, whether Seam's implicit usage of datasource mappings should be considered as a factor?