Early log entry for async EntityManagerFactory initialization failure
Closes gh-26093
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2020 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.
|
||||
@@ -193,8 +193,8 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
* {@code Persistence.createEntityManagerFactory} (if any).
|
||||
* <p>Can be populated with a String "value" (parsed via PropertiesEditor) or a
|
||||
* "props" element in XML bean definitions.
|
||||
* @see javax.persistence.Persistence#createEntityManagerFactory(String, java.util.Map)
|
||||
* @see javax.persistence.spi.PersistenceProvider#createContainerEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo, java.util.Map)
|
||||
* @see javax.persistence.Persistence#createEntityManagerFactory(String, Map)
|
||||
* @see javax.persistence.spi.PersistenceProvider#createContainerEntityManagerFactory(PersistenceUnitInfo, Map)
|
||||
*/
|
||||
public void setJpaProperties(Properties jpaProperties) {
|
||||
CollectionUtils.mergePropertiesIntoMap(jpaProperties, this.jpaPropertyMap);
|
||||
@@ -204,8 +204,8 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
* Specify JPA properties as a Map, to be passed into
|
||||
* {@code Persistence.createEntityManagerFactory} (if any).
|
||||
* <p>Can be populated with a "map" or "props" element in XML bean definitions.
|
||||
* @see javax.persistence.Persistence#createEntityManagerFactory(String, java.util.Map)
|
||||
* @see javax.persistence.spi.PersistenceProvider#createContainerEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo, java.util.Map)
|
||||
* @see javax.persistence.Persistence#createEntityManagerFactory(String, Map)
|
||||
* @see javax.persistence.spi.PersistenceProvider#createContainerEntityManagerFactory(PersistenceUnitInfo, Map)
|
||||
*/
|
||||
public void setJpaPropertyMap(@Nullable Map<String, ?> jpaProperties) {
|
||||
if (jpaProperties != null) {
|
||||
@@ -400,10 +400,13 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
String message = ex.getMessage();
|
||||
String causeString = cause.toString();
|
||||
if (!message.endsWith(causeString)) {
|
||||
throw new PersistenceException(message + "; nested exception is " + causeString, cause);
|
||||
ex = new PersistenceException(message + "; nested exception is " + causeString, cause);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (logger.isErrorEnabled()) {
|
||||
logger.error("Failed to initialize JPA EntityManagerFactory: " + ex.getMessage());
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user