I am learning JPA. I read about persistence.xml file. It can contain more that one <persistence-unit>
tag under <persistence>
tag.
Upto my undestanding, <persistence-unit>
defines:
- db connection settings
- classes(entity classes), jar files, and mapping files
- provider information
Then why would we need to group the entities of our application into different <persistence-unit>
. All the entities of any application should be in one <persistence-unit>
tag.
The only reason that I think that we need more than one <persistence-unit>
is when we need to establish connection with more than one datastore.
Q1. Are there any other situations when we need more than one <persistence-unit>
tag?