5 Replies Latest reply on Aug 26, 2009 4:38 PM by heapifyman heapifyman

    Accessing entities in other ear from seam project ear

    heapifyman heapifyman Newbie

      Hello all.


      I've been trying to use entities that are deployed in a separate ear file from my seam project (also in ear format) and am experiencing strange ClassCastException problems.
      My project structure looks like this:


      entity.ear
      |-- entity.jar (ejb-module)
      |-- common.jar (java-module)
      |-- thirdparty.jar (which entities depend on)
      |-- META-INF
      
      seam-project.ear
      |-- seam-project_jar
      |-- seam-project.war
      |-- lib
          |-- common.jar
          |-- entity.jar
          |-- thirdparty.jar
      |-- META-INF



      I added the following to entity.ear--entity.jar's persistence.xml:


      <property name="jboss.entity.manager.factory.jndi.name" value="java:/seam-projectEntityManagerFactory"/>



      If I'm not mistaken, this should allow the seam-project to use the EMF in the entity.ear and actually this seems to work.
      Everything is deployed correctly and I can execute queries like:


      List<EntityA> results = query.getResults();



      But statements like the following lead to ClassCastException:


      for (EntityA entityA : results) {...}
      EntityA entA = results.get(0);



      What am I missing here?


      P.S.: my environment: Win XP Pro, Java 1.5, JBoss AS 4.2.3, Seam 2.2.0.GA