title: How to layout Java EE projects using common JPA entities?
body: <p>I have two eclipse Java EE 6 projects packaged in a WAR-file using maven 3. Now they should share JPA entities in a 3rd project among them, since they both use the same database.</p>
  
  <p>When doing the research for my question, I found some hints mentioning for example a reference in a persistence.xml to a common jar, but I wasn't successful to make it work.
  So specifically asked:</p>
  
  <p>1) Does the project, containing the common entities, has a persistence.xml file? If so, how does it differ from the one in the other projects?</p>
  
  <p>2) How exactly are the commonly used entities referenced in the two projects? Do I use the  tag in their persistence.xml for reference? And if so, would "lib/MyCommon.jar" be the right way to use, if MyCommin.jar is located in WEB-INF/lib?</p>
  
  <p>3) Does it make any difference if the application is deployed as a WAR or an exploded archive in JBoss 6?</p>
  
  <p>4) When deployed within eclipse via addition to server runtime and publish, is there anything different from deploying outside eclipse?</p>
  
  <p>5) Is the described way putting common entities in a separate project, creating a JAR and use that JAR in the other project a sensible way to handle the problem of sharing common entity classes or is there a better way?</p>