[jboss-user] [JBoss Seam] - JAR with entities in a WebApp

yuriy_zubarev do-not-reply at jboss.com
Fri Oct 12 14:41:36 EDT 2007


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


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4094739#4094739

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4094739



More information about the jboss-user mailing list