Hi, this is the way to do, maybe check your system properties and database configurations. With some DB you can need some more config (thinking to oracle and schemas for instance)
Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <https://rmannibucau.metawerx.net/> | Old Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book <https://www.packtpub.com/application-development/java-ee-8-high-performance> 2018-03-16 9:23 GMT+01:00 Matthew Broadhead <[email protected]> : > hi, > i just wrote an email to users@openjpa but there doesn't seem to be much > activity there. > do you know how to declare multiple persistence units? i created 2 > persistence units inside persistence.xml but it seems to create the > entities from the second PU in the database of the first one. my > persistence.xml is like this. the operator tables get created inside the > file database > <?xml version="1.0" encoding="UTF-8"?> > <persistence xmlns="http://java.sun.com/xml/ns/persistence" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://java.sun.com/xml/ns/persistence > http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" > version="2.0"> > <persistence-unit name="file"> > <jta-data-source>file</jta-data-source> > <class>uk.me.kissy.file.entities.jpa.Box</class> > <class>uk.me.kissy.file.entities.jpa.Category</class> > <class>uk.me.kissy.file.entities.jpa.CqsReview</class> > <class>uk.me.kissy.file.entities.jpa.Department</class> > <class>uk.me.kissy.file.entities.jpa.Enclosure</class> > <class>uk.me.kissy.file.entities.jpa.Event</class> > <class>uk.me.kissy.file.entities.jpa.EventData</class> > <class>uk.me.kissy.file.entities.jpa.EventType</class> > <!-- <class>uk.me.kissy.file.entities.jpa.File</class> --> > <class>uk.me.kissy.file.entities.jpa.Log</class> > <class>uk.me.kissy.file.entities.jpa.Note</class> > <class>uk.me.kissy.file.entities.jpa.Payment</class> > <class>uk.me.kissy.file.entities.jpa.Price</class> > <class>uk.me.kissy.file.entities.jpa.Undertaking</class> > <class>uk.me.kissy.file.entities.jpa.UndertakingType</class> > <class>uk.me.kissy.file.entities.jpa.Workflow</class> > <properties> > <property name="openjpa.jdbc.SynchronizeMappings" > value="buildSchema(ForeignKeys=true)" /> > </properties> > </persistence-unit> > <persistence-unit name="operator"> > <jta-data-source>operator</jta-data-source> > <class>uk.me.kissy.file.entities.jpa.operator.Address</class> > <class>uk.me.kissy.file.entities.jpa.operator.Client</class> > <class>uk.me.kissy.file.entities.jpa.operator.Council</class> > <class>uk.me.kissy.file.entities.jpa.operator.Operator</class> > <class>uk.me.kissy.file.entities.jpa.operator.Posttown</class> > <class>uk.me.kissy.file.entities.jpa.operator.Wtr_auth</class> > </persistence-unit> > </persistence> >
