No, a persistence-unit is defined using a single persistence.xml file.
In your case you should just define one persistence-unit and refer to
all those jar files using the jar-file element.
Thanks,
Sahoo
Martin Bayly wrote:
> Is it supported to have a single persistence unit spread over multiple
> persistence xml files?
>
> The background behind this question is that we have a modular app
> where each module contributes some persistent entities.
> I would like to define a persistence.xml file for each module and have
> them all 'contribute' to a single common persistence unit at runtime.
>
> i.e. one module's xml file would contain:
>
> <persistence xmlns="http://java.sun.com/xml/ns/persistence"
> version="1.0">
> <persistence-unit name="pu1">
>
> <provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
>
>
> <class>com.mydomain.domain.Course</class>
>
> </persistence-unit>
> </persistence>
>
> And another module's persistence.xml file might contain
>
> <persistence xmlns="http://java.sun.com/xml/ns/persistence"
> version="1.0">
> <persistence-unit name="pu1">
>
> <provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
>
>
> <class>com.mydomain.domain.User</class>
>
> </persistence-unit>
> </persistence>
>
>
> Thanks
> Martin