Skip to content

Allows for on-the-fly persistence units merge without using hardcoded jar urls [SPR-7055] #11689

@spring-projects-issues

Description

@spring-projects-issues

Stéphane Nicoll opened SPR-7055 and commented

Since 3.0.1, DefaultPersistenceUnitManager does not return a MutablePersistenceUnitInfo but the standard PersistenceUnitInfo.

We have an extension of this class that allows to re conciliate multiple persistence.xml in a single one on the fly. Here's the idea. Assume that we have defined an empty persistence unit called "pu" and that is used by our entity manager. Our extensions of the PersistenceUnitManager scans all persistence.xml and if it matches a certain condition (here if the unit name starts with 'pu') then it is re conciliated with our bootstrap persistence unit.

To do so, we use the getPersistenceUnitInfo(String name) of the class. Up to 3.0, it was returning MutablePersistenceUnitInfo. Is there any way to have a protected method that returns the mutable class?

Btw, this is similar to what is described in #7287 except that JPA does not allow two different persistence.xml with the same persistence unit name (Weblogic namely checks that when deploying an app).

What do you think of our approach? I think I can workaround by casting but then:

  1. My code is no longer working with Spring 2.5.7
  2. Casting isn't ideal

Thanks


Affects: 3.0.1

Referenced from: commits 11bb726, 4ee6735

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions