Spring Framework
  1. Spring Framework
  2. SPR-8925

DefaultPersistenceUnitManager must not reject multiple PersistenceUnits with the same name eagerly

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Complete
    • Affects Version/s: 3.1 GA
    • Fix Version/s: 3.1.1
    • Component/s: Data
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      Commit 4482 introduced a snippet of code in preparePersistenceUnitInfos() that rejects PersistenceUnit instances with the very same name although the call to postProcessPersistenceUnitInfo(...) might have handled that case correctly. We rely on this behavior with Spring Data JPAs MergingPersistenceUnitManager and got reports (DATAJPA-138) claiming it's not working with Spring 3.1.

        Issue Links

          Activity

          Hide
          Oliver Gierke added a comment -

          I've added a test case to simulate the issue in a branch. It's green with 3.0.6 but starts failing if you open up the version boundary of the Spring dependencies beyond 3.1.0.

          Show
          Oliver Gierke added a comment - I've added a test case to simulate the issue in a branch . It's green with 3.0.6 but starts failing if you open up the version boundary of the Spring dependencies beyond 3.1.0.
          Hide
          Juergen Hoeller added a comment -

          I've added a protected "isPersistenceUnitOverrideAllowed()" method to DefaultPersistenceUnitManager. By default, it returns false since that may help users to detect conflicting persistence.xml scenarios at runtime. However, your merging PersistenceUnitManager subclass may override that method to return true, signalling that its postProcessPersistenceUnitInfo implementation is able to handle that case. That overridden method won't cause issues against Spring 3.0 either since it'll simply be ignored there.

          Juergen

          Show
          Juergen Hoeller added a comment - I've added a protected "isPersistenceUnitOverrideAllowed()" method to DefaultPersistenceUnitManager. By default, it returns false since that may help users to detect conflicting persistence.xml scenarios at runtime. However, your merging PersistenceUnitManager subclass may override that method to return true, signalling that its postProcessPersistenceUnitInfo implementation is able to handle that case. That overridden method won't cause issues against Spring 3.0 either since it'll simply be ignored there. Juergen

            People

            • Assignee:
              Juergen Hoeller
              Reporter:
              Oliver Gierke
              Last updater:
              Trevor Marshall
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                2 years, 17 weeks, 6 days ago