0 Replies Latest reply on May 25, 2006 5:30 AM by Thorsten Klusemann

    Packaging EJB3 Entity-Beans

    Thorsten Klusemann Newbie


      I am currently playing around with the new EJB3 specification within JBoss 4.0.4GA. What I want to do is to write a simple Help-Desk system for Customer-Support departments, just for fun as an example.

      I first created 2 Entity-Beans for Account-Management which are Account and Role, where every Account may have several Roles assigned to it. Additionally I created a session facade bean with some basic methods for working with the entities (create, update, retrieve and this kind of stuff). I packaged those Beans into a single EJB-jar file and it works.

      I now want to add an Address-Entity, because every Account may have one ore more Addresses assigned to it. I am thinking about packaging the Address-related beans into another EJB-jar file with its own persistence.xml, because Addresses are not only useful for Account management.

      In EJB3, is it a good practice to do so or should I package all my application beans into one EJB-jar file? If I use several EJB-jars, is there a Hibernate session factory created for each of them or will JBoss use the same factory for all?