Sync with 3.1.x
* 3.1.x: (61 commits) Compensate for changes in JDK 7 Introspector Avoid 'type mismatch' errors in ExtendedBeanInfo Polish ExtendedBeanInfo and tests Infer AnnotationAttributes method return types Minor fix in MVC reference doc chapter Hibernate 4.1 etc TypeDescriptor equals implementation accepts annotations in any order "setBasenames" uses varargs now (for programmatic setup; SPR-9106) @ActiveProfiles mechanism works with @ImportResource as well (SPR-8992 polishing clarified Resource's "getFilename" method to consistently return null substituteNamedParameters detects and unwraps SqlParameterValue object Replace spaces with tabs Consider security in ClassUtils#getMostSpecificMethod Adding null check for username being null. Improvements for registering custom SQL exception translators in app c SPR-7680 Adding QueryTimeoutException to the DataAccessException hiera Minor polish in WebMvcConfigurationSupport Detect overridden boolean getters in ExtendedBeanInfo Polish ExtendedBeanInfoTests ...
This commit is contained in:
@@ -2,15 +2,15 @@
|
||||
/**
|
||||
*
|
||||
* Package providing integration of
|
||||
* <a href="http://www.hibernate.org">Hibernate3</a>
|
||||
* <a href="http://www.hibernate.org">Hibernate 3.x</a>
|
||||
* with Spring concepts.
|
||||
*
|
||||
*
|
||||
* <p>Contains SessionFactory helper classes, a template plus callback
|
||||
* for Hibernate access, and an implementation of Spring's transaction SPI
|
||||
* for local Hibernate transactions.
|
||||
*
|
||||
*
|
||||
* <p><b>This package supports Hibernate 3.x only.</b>
|
||||
* See the org.springframework.orm.hibernate package for Hibernate 2.1 support.
|
||||
* See the <code>org.springframework.orm.hibernate4</code> package for Hibernate 4.x support.
|
||||
*
|
||||
*/
|
||||
package org.springframework.orm.hibernate3;
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
/**
|
||||
*
|
||||
* Package providing integration of
|
||||
* <a href="http://www.hibernate.org">Hibernate 4.0</a>
|
||||
* <a href="http://www.hibernate.org">Hibernate 4.x</a>
|
||||
* with Spring concepts.
|
||||
*
|
||||
*
|
||||
* <p>Contains an implementation of Spring's transaction SPI for local Hibernate transactions.
|
||||
* This package is intentionally rather minimal, relying on native Hibernate builder APIs
|
||||
* for building a SessionFactory (for example in an @Bean method in a @Configuration class).
|
||||
* This package is intentionally rather minimal, with no template classes or the like,
|
||||
* in order to follow native Hibernate recommendations as closely as possible.
|
||||
*
|
||||
* <p><b>This package supports Hibernate 4.x only.</b>
|
||||
* See the org.springframework.orm.hibernate3 package for Hibernate 3.x support.
|
||||
* See the <code>org.springframework.orm.hibernate3</code> package for Hibernate 3.x support.
|
||||
*
|
||||
*/
|
||||
package org.springframework.orm.hibernate4;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -306,7 +306,7 @@ public abstract class EntityManagerFactoryUtils {
|
||||
return new JpaObjectRetrievalFailureException((EntityNotFoundException) ex);
|
||||
}
|
||||
if (ex instanceof NoResultException) {
|
||||
return new EmptyResultDataAccessException(ex.getMessage(), 1);
|
||||
return new EmptyResultDataAccessException(ex.getMessage(), 1, ex);
|
||||
}
|
||||
if (ex instanceof NonUniqueResultException) {
|
||||
return new IncorrectResultSizeDataAccessException(ex.getMessage(), 1, ex);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -123,6 +123,17 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage
|
||||
this.internalPersistenceUnitManager.setPersistenceXmlLocation(persistenceXmlLocation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses the specified persistence unit name as the name of the default
|
||||
* persistence unit, if applicable.
|
||||
* <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b>
|
||||
*/
|
||||
@Override
|
||||
public void setPersistenceUnitName(String persistenceUnitName) {
|
||||
super.setPersistenceUnitName(persistenceUnitName);
|
||||
this.internalPersistenceUnitManager.setDefaultPersistenceUnitName(persistenceUnitName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether to use Spring-based scanning for entity classes in the classpath
|
||||
* instead of using JPA's standard scanning of jar files with <code>persistence.xml</code>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -55,6 +55,7 @@ import org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup;
|
||||
import org.springframework.jdbc.datasource.lookup.MapDataSourceLookup;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
|
||||
/**
|
||||
* Default implementation of the {@link PersistenceUnitManager} interface.
|
||||
@@ -328,7 +329,7 @@ public class DefaultPersistenceUnitManager
|
||||
/**
|
||||
* Prepare the PersistenceUnitInfos according to the configuration
|
||||
* of this manager: scanning for <code>persistence.xml</code> files,
|
||||
* parsing all matching files, configurating and post-processing them.
|
||||
* parsing all matching files, configuring and post-processing them.
|
||||
* <p>PersistenceUnitInfos cannot be obtained before this preparation
|
||||
* method has been invoked.
|
||||
* @see #obtainDefaultPersistenceUnitInfo()
|
||||
@@ -404,6 +405,12 @@ public class DefaultPersistenceUnitManager
|
||||
String className = reader.getClassMetadata().getClassName();
|
||||
if (matchesFilter(reader, readerFactory)) {
|
||||
scannedUnit.addManagedClassName(className);
|
||||
if (scannedUnit.getPersistenceUnitRootUrl() == null) {
|
||||
URL url = resource.getURL();
|
||||
if (ResourceUtils.isJarURL(url)) {
|
||||
scannedUnit.setPersistenceUnitRootUrl(ResourceUtils.extractJarFileURL(url));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -43,7 +43,7 @@ import org.springframework.util.xml.DomUtils;
|
||||
import org.springframework.util.xml.SimpleSaxErrorHandler;
|
||||
|
||||
/**
|
||||
* Internal helper class for reading <code>persistence.xml</code> files.
|
||||
* Internal helper class for reading JPA-compliant <code>persistence.xml</code> files.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Juergen Hoeller
|
||||
@@ -227,7 +227,7 @@ class PersistenceUnitReader {
|
||||
/**
|
||||
* Parse the unit info DOM element.
|
||||
*/
|
||||
protected SpringPersistenceUnitInfo parsePersistenceUnitInfo(Element persistenceUnit, String version) throws IOException { // JC: Changed
|
||||
protected SpringPersistenceUnitInfo parsePersistenceUnitInfo(Element persistenceUnit, String version) throws IOException {
|
||||
SpringPersistenceUnitInfo unitInfo = new SpringPersistenceUnitInfo();
|
||||
|
||||
// set JPA version (1.0 or 2.0)
|
||||
|
||||
Reference in New Issue
Block a user