Enhance multiple entity manager factories how-to

See gh-14928
pull/27078/head
Niclas Fredriksson 6 years ago committed by Stephane Nicoll
parent a1a2f00b65
commit 0d9db46f68

@ -1798,9 +1798,10 @@ Spring Boot auto-configuration switches off its entity manager in the presence o
[[howto-use-two-entity-managers]] [[howto-use-multiple-entity-managers]]
=== Use Two EntityManagers === Using Multiple EntityManagerFactories
Even if the default `EntityManagerFactory` works fine, you need to define a new one, otherwise the presence of the second bean of that type switches off the default. Sometimes you may wish to work with multiple Entity Manager Factories, because you have multiple data sources.
In those cases, you need to create your own `EntityManagerFactory` for each datasource.
You can use the `EntityManagerBuilder` provided by Spring Boot to help you to create one. You can use the `EntityManagerBuilder` provided by Spring Boot to help you to create one.
Alternatively, you can use the `LocalContainerEntityManagerFactoryBean` directly from Spring ORM, as shown in the following example: Alternatively, you can use the `LocalContainerEntityManagerFactoryBean` directly from Spring ORM, as shown in the following example:

Loading…
Cancel
Save