There are few applications that use java persistence. Each application has its own set of entities that represents the same tables in DB. For instance, application A has entities for Table1, Table2, etc; at the same time, application B also has entities for Table1, Table2, etc. Instead of that I want to create a new EJB module with 1 bean with local interface, move all entities into it, and add it as a library to projects that may require access to persistent objects. So, it will look like
@Stateless
public class DataBean implements DataLocal {
@PersistenceContext(unitName="my_data")
private EntityManager em ;
public EntityManager getManager()
{
return em;
};
}
I'm pretty new in Java-ee, so I wonder whether it is a poor design or not. Thanks in advance.