From b95c43e913f222560d437c140071cec213d4b014 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Wed, 8 Jun 2011 08:03:03 +0000 Subject: [PATCH] added section on JPA EntityManagerFactory bootstrapping without persistence.xml git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4491 50f2f4bb-b051-0410-bef5-90022cba6387 --- spring-framework-reference/src/new-in-3.1.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spring-framework-reference/src/new-in-3.1.xml b/spring-framework-reference/src/new-in-3.1.xml index 4e836dc2152..c5b63337fc1 100644 --- a/spring-framework-reference/src/new-in-3.1.xml +++ b/spring-framework-reference/src/new-in-3.1.xml @@ -181,6 +181,20 @@ +
+ JPA EntityManagerFactory bootstrapping without persistence.xml + In standard JPA, persistence units get defined through META-INF/persistence.xml + files in specific jar files which will in turn get searched for @Entity classes. + In many cases, persistence.xml does not contain more than a unit name and relies on defaults and/or + external setup for all other concerns (such as the DataSource to use, etc). For that reason, Spring 3.1 + provides an alternative: LocalContainerEntityManagerFactoryBean accepts a + 'packagesToScan' property, specifying base packages to scan for @Entity classes. + This is analogous to AnnotationSessionFactoryBean's property of the same name + for native Hibernate setup, and also to Spring's component-scan feature for regular Spring beans. + Effectively, this allows for XML-free JPA setup at the mere expense of specifying a base package for + entity scanning: a particularly fine match for Spring applications which rely on component scanning + for Spring beans as well, possibly even bootstrapped using a code-based Servlet 3.0 initializer. +
New HandlerMethod-based Support Classes For Annotated Controller Processing Spring 3.1 introduces a new set of support classes for processing requests