Fixed misunderstanding with respect to excludeUnlistedClasses default in JPA 2.0
Issue: SPR-10767
(cherry picked from commit d0948f1)
This commit is contained in:
@@ -21,7 +21,6 @@ import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.SharedCacheMode;
|
||||
import javax.persistence.ValidationMode;
|
||||
import javax.persistence.spi.PersistenceUnitTransactionType;
|
||||
@@ -35,6 +34,7 @@ import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.xml.sax.ErrorHandler;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.support.ResourcePatternResolver;
|
||||
import org.springframework.jdbc.datasource.lookup.DataSourceLookup;
|
||||
@@ -83,8 +83,6 @@ class PersistenceUnitReader {
|
||||
|
||||
private static final String META_INF = "META-INF";
|
||||
|
||||
private static final String VERSION_1 = "1.0";
|
||||
|
||||
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@@ -251,7 +249,7 @@ class PersistenceUnitReader {
|
||||
unitInfo.setTransactionType(PersistenceUnitTransactionType.valueOf(txType));
|
||||
}
|
||||
|
||||
// data-source
|
||||
// evaluate data sources
|
||||
String jtaDataSource = DomUtils.getChildElementValueByTagName(persistenceUnit, JTA_DATA_SOURCE);
|
||||
if (StringUtils.hasText(jtaDataSource)) {
|
||||
unitInfo.setJtaDataSource(this.dataSourceLookup.getDataSource(jtaDataSource.trim()));
|
||||
@@ -270,14 +268,9 @@ class PersistenceUnitReader {
|
||||
|
||||
// exclude unlisted classes
|
||||
Element excludeUnlistedClasses = DomUtils.getChildElementByTagName(persistenceUnit, EXCLUDE_UNLISTED_CLASSES);
|
||||
if (excludeUnlistedClasses == null) {
|
||||
// element is not defined, use default appropriate for version
|
||||
unitInfo.setExcludeUnlistedClasses(!VERSION_1.equals(version));
|
||||
}
|
||||
else {
|
||||
if (excludeUnlistedClasses != null) {
|
||||
String excludeText = DomUtils.getTextValue(excludeUnlistedClasses);
|
||||
unitInfo.setExcludeUnlistedClasses(StringUtils.isEmpty(excludeText) ||
|
||||
Boolean.valueOf(excludeText));
|
||||
unitInfo.setExcludeUnlistedClasses(!StringUtils.hasText(excludeText) || Boolean.valueOf(excludeText));
|
||||
}
|
||||
|
||||
// set JPA 2.0 shared cache mode
|
||||
|
||||
Reference in New Issue
Block a user