vendredi 22 mai 2015

JPA / Hibernate : schema generation with multiple persistence units

I have an application that uses a set of JPA entities that are located in 2 different databases. I configured it with multiple persistence units.

The problem is that I want to auto-generate the schema using schema-generation, and all the entities are created in both databases.

I have in both PUs:

        <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
        <property name="javax.persistence.schema-generation.create-source" value="metadata"/>
        <property name="javax.persistence.schema-generation.drop-source" value="metadata"/>

And, yes, I want to use the metadata to get the entities automatically. I do not want to provide a manual script, because I would need to keep it up to date with the entities.

Is there a way to mark which entity to be generated by which PU?

Aucun commentaire:

Enregistrer un commentaire