title: How to best share entity classes/DAOs across multiple PUs?
body: <p>Let's take a basic example, say we have an entity class </p>
  
  <pre><code>@Entity
  public class User {
  }
  </code></pre>
  
  <p>and a DAO for dealing with the data:</p>
  
  <pre><code>public interface UserDao {
      @Transactional
      public void changeUser(User user);
  }
  
  @Repository
  public class UserDaoImpl implements UserDao {
      @PersistenceContext
      private EntityManager em;
  
      @Override
      public void changeUser(User user) {
          // ...
      }
  }
  </code></pre>
  
  <p>We have a main Maven Project that contains plenty other sub-projects, that we use for building multiple application (WARs, JARs etc.). Our framework of choice is Spring.</p>
  
  <p>Each and every application needs the above entity / DAO and there are no per application customizations needed, everything remains the same.
  Every application has its own data source / persistence unit / transaction manager.</p>
  
  <p>How can one best reuse the above entity / DAO across multiple applications? The entities need to be persisted in the application's database and we'd also need to reuse the app's transaction manager.</p>
  
  <p>What did you do in similar situations?</p>