Polish documentation

Improve the documentation on using two entity managers if Spring Data is
used.

Closes gh-3433
This commit is contained in:
Stephane Nicoll 2015-08-07 10:13:34 +02:00
parent bae3dcba33
commit 95dac0bbec
1 changed files with 21 additions and 0 deletions

View File

@ -1440,6 +1440,27 @@ be picked up by the default `JpaTransactionManager` in Spring Boot if you mark i
`@Primary`. The other would have to be explicitly injected into a new instance. Or you
might be able to use a JTA transaction manager spanning both.
If you are using Spring Data, you need to configure `@EnableJpaRepositories` accordingly:
[source,java,indent=0,subs="verbatim,quotes,attributes"]
----
@Configuration
@EnableJpaRepositories(basePackageClasses = Customer.class,
entityManagerFactoryRef = "customerEntityManagerFactory")
public class CustomerConfiguration {
...
}
@Configuration
@EnableJpaRepositories(basePackageClasses = Order.class,
entityManagerFactoryRef = "orderEntityManagerFactory")
public class OrderConfiguration {
...
}
----
[[howto-use-traditional-persistence-xml]]