7 Replies Latest reply on Oct 12, 2007 5:44 PM by Pete Muir

    JAR with entities in a WebApp

    Yuriy ZUbarev Newbie

      Hello,

      I'm trying to set up Seam (2.0.0) Web App under Tomcat 6.0 in a such a way as to have 2 POM project. One is with entities (@Entity) and another one is a web app itself (and there is a parent POM of course). The idea is that entities could be re-used between different sub-projects.

      He is my structure:

      .
       |-- pom.xml
       |
       |-- entity
       | |-- pom.xml
       | |-- src
       | |-- main
       | |-- java
       | | |-- entitypackage
       | | |-- Book.java
       | |-- resources
       | |-- seam.properties
       |
       |-- webapp
       |-- pom.xml
       |-- src
       |-- main
       |-- java
       | |-- webpackage
       | |-- BookController.java
       |-- resources
       | |-- seam.properties
       |-- webapp
       |-- META-INF
       | |-- context.xml
       | |-- persistence.xml
       |-- WEB-INF
       |-- web.xml
       |-- components.xml
       |-- pages.xml
      


      In BookController I have something like this:

      this.books = em.createQuery("select b from entitypackage.Book b").getResultList();
      


      When the web app is running this is what I see in a log file:

      WARNING: no persistent classes found for query class: select b from entitypackage.Book b
      


      When I move Book.java to webapp project, everything works like a charm. I also tried to provide persistence.xml under entity/META-INF and provide "class" element in there but it didn't help.

      I was wondering how I can separate entity (and java beans/session) classes from the actual web application and still enjoy the benefits of Seam. Just to stress it again, I'm building a light-weight web app to be run under Tomcat without EJB embedded container.

      Thank you.
      Yuriy