I have a JavaEE project that makes use of multiple persistence units. Is there any way to specify which persistence unit a particular JPA Entity belongs to? Some entities
The @PersistenceUnit should be usable as well (I haven't tried it, yet, though)
e.g.
@PersistenceUnit(unitName="persistenceUnit2")
@Entity
class XPTO {
}
From the Javadoc (http://docs.oracle.com/javaee/6/api/javax/persistence/PersistenceUnit.html)
"Expresses a dependency on an EntityManagerFactory and its associated persistence unit."
unitName (Optional) The name of the persistence unit as defined in the persistence.xml file.