JPA it’s the most used standard in java to manage the persistence and I ever want to write about this topic.
In this entry I want to share how configure a java project to use JPA with spring with two data sources, you can view all source of this project on my github repository.
Most of the configuration is in spring, in the application context you need declare:
- 2 Data Sources
- 2 Entity Manager Factories
- 2 Transaction Manager
This is explained by self: