title: map three database in the same time
body: <p>I have to map Three database on my project (Web application),using Hibernate/JPA ,so my question is how can I configure persistance.xml to support the three connections
  this are my files :
   <strong>persistance.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence version="2.0" 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"&gt;
  &lt;persistence-unit name="JiraMapPU" transaction-type="RESOURCE_LOCAL"&gt;
  &lt;provider&gt;org.eclipse.persistence.jpa.PersistenceProvider&lt;/provider&gt;
  &lt;class&gt;DTOKpi.AssociationKpiProfil&lt;/class&gt;  //from  database1
  &lt;class&gt;DTOKpi.Kpi&lt;/class&gt;                  //database1
  &lt;class&gt;DTOKpi.ProfilUser&lt;/class&gt;          //  database1
  &lt;class&gt;DTOJIRA.Resolution&lt;/class&gt;         //  database2
  &lt;class&gt;DTOJIRA.Project&lt;/class&gt;           //  database2
  &lt;class&gt;DTOJIRA.Issuestatus&lt;/class&gt;
  &lt;class&gt;DTOJIRA.Jiraissue&lt;/class&gt;
  &lt;class&gt;DTOJIRA.Priority&lt;/class&gt;
  &lt;class&gt;DTOJIRA.Component&lt;/class&gt;
  &lt;class&gt;DTOJIRA.Issuetype&lt;/class&gt;
  &lt;exclude-unlisted-classes&gt;false&lt;/exclude-unlisted-classes&gt;
  &lt;properties&gt;
    &lt;property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/jiradb"/&gt;
    &lt;property name="javax.persistence.jdbc.password" value="root"/&gt;
    &lt;property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/&gt;
    &lt;property name="javax.persistence.jdbc.user" value="root"/&gt;
  &lt;/properties&gt;
  </code></pre>
  
  <p>
  </p>
  
  <p><strong>My hibernate.cfg.xml</strong></p>
  
  <pre><code>&lt;!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD  3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt;
  &lt;hibernate-configuration&gt;
  &lt;session-factory&gt;
  &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt;
  &lt;property name="hibernate.connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt;
  &lt;property name="hibernate.connection.url"&gt;jdbc:mysql://localhost:3306/jiradb&lt;/property&gt;
  &lt;property name="hibernate.connection.username"&gt;root&lt;/property&gt;
  &lt;mapping resource="DTOTest/issuestatus.hbm.xml"/&gt;
  &lt;mapping resource="hibernate.hbm.xml"/&gt;
  &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>I have found this link useful: <a href="https://stackoverflow.com/questions/2311614/how-do-i-connect-to-multiple-databases-using-jpa">How do I connect to multiple databases using JPA?</a> but I couldn't understand the second step  </p>