Join multiple persistence.xml files together

457 views Asked by At

I am using guice persist which relies on me listing my persistence units in a persistence.xml. As far as I can tell, there is no way to pass PersistenceUnitInfo at runtime to guice-persist.

However, where I have multiple databases, I have the models in separate projects and therefore want separate persistence.xml files.

Is there a way I can get maven to join these for me at compile time to avoid me having one file with all my persistence units in?

1

There are 1 answers

1
user3583816 On
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">

    <persistence-unit name="de.cware.cweb.projects.ee.user">
        <class>de.cware.cweb.services.user.model.JpaUserImpl</class>
    </persistence-unit>
    <persistence-unit name="de.cware.cweb.projects.ee.role">
        <class>de.cware.cweb.services.role.model.JpaRoleImpl</class>
    </persistence-unit>
</persistence>