Page 1 of 1

Issue with MergePersistenceUnitManager in 2.0.0-GA

Posted: Wed Oct 10, 2012 5:47 pm
by rgendler
Hi,

I am trying to understand the reason for the following code fragment from MergePersistenceUnitManager line 83

for (String legacyLocation : tempLocations) {
if (!legacyLocation.endsWith("/persistence.xml")) {
//do not add the default JPA persistence location by default
mergedPersistenceXmlLocations.add(legacyLocation);
}
}


It seems that this excludes any value from persistenceXmlLocations property that contains "persistence.xml" in it. Why is this necessary?

I am having an issue with that. I have an existing JPA descriptor that allows and access to a different database and it has a default name persistence.xml. This code snippet prevents me from using MergePersistenceUnitManager to initialize persistence units in that descriptor. Previously it worked with version 1.5.4

Re: Issue with MergePersistenceUnitManager in 2.0.0-GA

Posted: Fri Oct 12, 2012 9:55 am
by aazzolini
How are you configuring your persistence.xml file?

We use a file named "persistence.xml" by default in the DemoSite, configured like this:

Code: Select all

    <bean id="blMergedPersistenceXmlLocations" class="org.springframework.beans.factory.config.ListFactoryBean">
        <property name="sourceList">
            <list>
                <value>classpath*:/META-INF/persistence.xml</value>
            </list>
        </property>
    </bean>


If i set a debug point on 83, that value is already in the mergedPersistenceXmlLocations Set.

Is yours not already in that set? If not, how are you attempting to add your persistence.xml?