0

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.

My persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<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">
    <persistence-unit name="Test" transaction-type="RESOURCE_LOCAL">

        <class>persistencetier.Ap_Interface_Intercompany_Entity</class>
        <class>persistencetier.HealthCheckEntity</class>
        <class>persistencetier.HealthSummaryEntity</class>
        <class>persistencetier.LockBoxEntity</class>
        <class>persistencetier.Receivable_Ar_InterfaceEntity</class>
        <properties>
            <property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin:@Localhost:1521:xe"/>
            <property name="javax.persistence.jdbc.user" value="****"/>
            <property name="javax.persistence.jdbc.password" value="****"/>
            <property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver"/>
        </properties>
    </persistence-unit>
</persistence>

0 Answers0