Hello. I apologize in advance for the very long e-mail. Hopefully more info helps.
I'm getting a rather strange error and I'm at a loss at how to proceed. I'm trying to build a collection of entity component jars that fulfill different aspects of a business model. I will eventually have upwards of 100 classes and so have broken the model down into about 10 different libraries. Each library's components inherit their most basic common traits from a single class, which is kept in a "base" jar. My goal is to be able to have components in other jars inherit from this @MappedSuperclass object. So far, I have been successful in creating a first entity bean that inherits from this MappedSuperclass INSIDE of the base JAR. I am now turning my attention to getting a second entity bean in a different JAR to inherit from the MappedSuperclass in the base jar. I am deploying in an embedded OpenEJB environment in Tomcat. I have a single servlet, in which I instantiate both the FirstEntity class and the Second Entity class. Each of these beans is then sent to a Stateless Session Bean to be persisted into the Database. This code is shown here: // inside of my servlet class: @EJB private BeanManager mgr; ... // inside of the doGet(...) method: FirstEntity ent1 = new FirstEntity(); ent1.setName("Entity name"); ent1.setDescription("Entity description"); ent1.setType("Entity type"); mgr.persist(ent1); SecondEntity ent2 = new SecondEntity(); ent2.setName("Entity name 2"); ent2.setDescription("Entity description 2"); ent2.setSecondType("Entity type 2"); mgr.persist(ent2); ... I'm using a stateless session bean at this point, because servlet's aren't transactional and my understanding is that manually wiring into entity managers directly from the servlet requires that the entity components are pre-cooked by OpenJPA. However, if the entity persistence is managed inside of a session bean, OpenEJB can do more of that preparation work. After a short discussion with Dain earlier, I set up my program to reference the persistence units from inside of this stateless session bean and let OpenEJB take care of obtaining the persistence context. The implementation of my BeanManager interface is shown here: @Stateless public class DefaultBeanManager implements BeanManager { @PersistenceUnit(unitName="corm-base") EntityManagerFactory emf; @PersistenceUnit(unitName="corm-party") EntityManagerFactory emf2; public void persist(FirstEntity a) { System.setProperty("openjpa.ConnectionDriverName", " com.mysql.jdbc.Driver"); System.setProperty("openjpa.ConnectionURL", "jdbc:mysql://localhost/corm"); System.setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema"); System.setProperty("openjpa.ConnectionUserName", "root"); System.setProperty("openjpa.ConnectionPassword", "n00p455wyrd"); EntityManager em = emf.createEntityManager(); em.getTransaction().begin(); em.persist(a); em.getTransaction().commit(); em.close(); } public void persist(SecondEntity a) { System.setProperty("openjpa.ConnectionDriverName", " com.mysql.jdbc.Driver"); System.setProperty("openjpa.ConnectionURL", "jdbc:mysql://localhost/corm"); System.setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema"); System.setProperty("openjpa.ConnectionUserName", "root"); System.setProperty("openjpa.ConnectionPassword", "n00p455wyrd"); EntityManager em = emf2.createEntityManager(); em.getTransaction().begin(); em.persist(a); em.getTransaction().commit(); em.close(); } } My problem is that I am now getting the following error: <openjpa-1.0.0-r420667:568756 fatal user error> org.apache.openjpa.persistence.ArgumentException: A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName property. This is very confusing because when I was only using the first entity bean and its mapped superclass inside of a single JAR and persistence unit, (the first of the two methods in the BeanManager implementation above), the persistence was working fine. My two entity beans and their mapped superclass are shown here: @MappedSuperclass public class Archetype implements Serializable { private String name = ""; private String description = ""; public Archetype() {} public String getName(){ return name; } public void setName(String name) { this.name = name; } public String getDescription(){ return description; } public void setDescription(String description) { this.description = description; } } @Entity @Inheritance(strategy=InheritanceType.JOINED) public class FirstEntity extends Archetype { @Id @GeneratedValue(strategy=GenerationType.AUTO) private long id; private String type; public String getType() { return type; } public void setType(String type) { this.type = type; } public long getId() { return id; } public void setId(long id) { this.id = id; } } @Entity @Inheritance(strategy=InheritanceType.JOINED) public class SecondEntity extends Archetype { @Id @GeneratedValue(strategy=GenerationType.AUTO) private long id; private String secondType; public long getId() { return id; } public void setId(long id) { this.id = id; } public String getSecondType() { return secondType; } public void setSecondType(String secondType) { this.secondType = secondType; } } Finally, the persistence.xml files for each component jar are identical with the exception of their persistence-unit name. I'll post one of them here. The other is named "corm-base": <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"> <persistence-unit name="corm-party" transaction-type="RESOURCE_LOCAL"> </persistence-unit> </persistence> How should I correctly configure the ConnectionDriverName property for multiple persistence units so that these component jars can cooperate? Any help is appreciated, -- Alex