title: How to Get the Properties in a persistence.xml of JPA from outside the war file or from a properties files?
body: <p>I have a persistence.xml file used to connect to a database but presently all the properties are hard coded inside it in the properties tag , i want to externalize it like if possible outside of my application i:e my war file or if not then in a properties files.
  how to make such a change.</p>
  
  <p>My persistence.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"&gt;
      &lt;persistence-unit name="Test" transaction-type="RESOURCE_LOCAL"&gt;
  
          &lt;class&gt;persistencetier.Ap_Interface_Intercompany_Entity&lt;/class&gt;
          &lt;class&gt;persistencetier.HealthCheckEntity&lt;/class&gt;
          &lt;class&gt;persistencetier.HealthSummaryEntity&lt;/class&gt;
          &lt;class&gt;persistencetier.LockBoxEntity&lt;/class&gt;
          &lt;class&gt;persistencetier.Receivable_Ar_InterfaceEntity&lt;/class&gt;
          &lt;properties&gt;
              &lt;property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin:@Localhost:1521:xe"/&gt;
              &lt;property name="javax.persistence.jdbc.user" value="****"/&gt;
              &lt;property name="javax.persistence.jdbc.password" value="****"/&gt;
              &lt;property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver"/&gt;
          &lt;/properties&gt;
      &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>