Skip to content

Commit

Permalink
added section on JPA EntityManagerFactory bootstrapping without persi…
Browse files Browse the repository at this point in the history
…stence.xml
  • Loading branch information
jhoeller committed Jun 8, 2011
1 parent d5b9b26 commit 3741ac7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions spring-framework-reference/src/new-in-3.1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,20 @@
</listitem>
</itemizedlist>
</section>
<section>
<title>JPA EntityManagerFactory bootstrapping without persistence.xml</title>
<para>In standard JPA, persistence units get defined through <literal>META-INF/persistence.xml</literal>
files in specific jar files which will in turn get searched for <literal>@Entity</literal> 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: <classname>LocalContainerEntityManagerFactoryBean</classname> accepts a
'packagesToScan' property, specifying base packages to scan for <literal>@Entity</literal> classes.
This is analogous to <classname>AnnotationSessionFactoryBean</classname>'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.</para>
</section>
<section>
<title>New HandlerMethod-based Support Classes For Annotated Controller Processing</title>
<para>Spring 3.1 introduces a new set of support classes for processing requests
Expand Down

0 comments on commit 3741ac7

Please sign in to comment.