Merging multiple persistence.xml is working for Spring 2 not working for Spring 3.1
I have requirement of using multiple persistence.xml file in more than one module (jars) inside a web application (war). I need to merge all the persistence.xml file with the same persistence context name("default") and create and use the EntityManager out of them. I used 'MergePersistenceUnitManager.java' code. It was working for spring 2, but not working for spring 3.1
It gives error - "Conflicting persistence unit definitions for name 'default'"
This issue is caused because of code change for 'DefaultPersistenceUnitManager.java' in springframework 3.1 ie.
if (!this.persistenceUnitInfoNames.add(name)) {
StringBuilder msg = new StringBuilder();
msg.append("Conflicting persistence unit definitions for name '").append(name).append("': ");
msg.append(pui.getPersistenceUnitRootUrl()).append (", ");
msg.append(this.persistenceUnitInfos.get(name).get PersistenceUnitRootUrl());
throw new IllegalStateException(msg.toString());
}
Please help me to solve this issue. It is urgent. :confused: