As the title states, is it possible to have 2 persistence units
in 1 bundle
, and therefore two EntiManagers
In OSGI, a persistence bundle
has the following in its pom.xml
file :
<Meta-Persistence>META-INF/persistence.xml</Meta-Persistence>
where persistence.xml
defines the persistence unit
So if it is possible:
thank you
Yes, the OSGi JPA Specification allows for the Meta-Persistence
header to be specified as a comma-separated list of resources. You can read full details in section 127.4.2 ("Meta Persistence Header") of the OSGi Compendium Release 6 Specification.
You also asked if Hibernate presents a problem. It should not, so long as the JPA Provider implementation you are using is compliant with the OSGi JPA Specification.