-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Nick Williams opened SPR-10767 and commented
This exact same problem also exists in Hibernate ORM (see attached reference URL).
In JPA 1.0's persistence.xml, <exclude-unlisted-classes> defaulted to false (providers always scanned for entities). So, you could have the following four uses of <exclude-unlisted-classes> with the indicated meanings:
- Omitted means don't exclude / do scan.
<exclude-unlisted-classes />means exclude / don't scan.<exclude-unlisted-classes>false</exclude-unlisted-classes>means don't exclude / do scan.<exclude-unlisted-classes>true</exclude-unlisted-classes>means exclude / don't scan.
As of JPA 2.0, <exclude-unlisted-classes> was changed to default to true:
- Omitted means exclude / don't scan.
<exclude-unlisted-classes />means exclude / don't scan.<exclude-unlisted-classes>false</exclude-unlisted-classes>means don't exclude / do scan.<exclude-unlisted-classes>true</exclude-unlisted-classes>means exclude / don't scan.
However, PersistenceUnitReader sets the value of ExcludeUnlistedClasses to true if <exclude-unlisted-classes> is merely present, regardless of its value...
...
Element excludeUnlistedClasses = DomUtils.getChildElementByTagName(persistenceUnit, EXCLUDE_UNLISTED_CLASSES);
if (excludeUnlistedClasses != null) {
unitInfo.setExcludeUnlistedClasses(true);
}
......and leaves it as the default value (false in MutablePersistenceUnitInfo) if <exclude-unlisted-classes> is missing. This is incorrect. It will result in the default value being incorrect in JPA 2.0/2.1, and in the value being incorrectly set if persistence.xml contains <exclude-unlisted-classes>false</exclude-unlisted-classes>.
Affects: 3.1 GA, 3.2 GA, 4.0 M1
Reference URL: https://hibernate.atlassian.net/browse/HHH-8364
Issue Links:
- Spring no longer recognizes mapped classes [SPR-10826] #15452 Spring no longer recognizes mapped classes