From 1cad98dd316475b1855c31ab28e705a89baadb28 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 17 Aug 2016 17:40:58 +0200 Subject: [PATCH] Add setter for defaultPersistenceUnitRootLocation This commit adds a setter for the default persistence unit's defaultPersistenceUnitRootLocation attribute. --- .../jpa/LocalContainerEntityManagerFactoryBean.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBean.java b/spring-orm/src/main/java/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBean.java index c64eb2e505..6e6c176cfb 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBean.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBean.java @@ -143,6 +143,18 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage this.internalPersistenceUnitManager.setDefaultPersistenceUnitName(persistenceUnitName); } + /** + * Set the default persistence unit root location, to be applied + * if no unit-specific persistence unit root could be determined. + *

NOTE: Only applied if no external PersistenceUnitManager specified. + *

Default is "classpath:", that is, the root of the current classpath + * (nearest root directory). To be overridden if unit-specific resolution + * does not work and the classpath root is not appropriate either. + */ + public void setDefaultPersistenceUnitRootLocation(String defaultPersistenceUnitRootLocation) { + this.internalPersistenceUnitManager.setDefaultPersistenceUnitRootLocation(defaultPersistenceUnitRootLocation); + } + /** * 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}