XML : Getting user and password from system/file in persistence.xml

I am pretty new to spring/hibernate. I see that the DB connection settings in persistence.xml file is:

  <properties>          <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/tbm" />          <property name="javax.persistence.jdbc.user" value="root" />          <property name="javax.persistence.jdbc.password" value="root" />          <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />          <property name="hibernate.show_sql" value="true" />          <property name="hibernate.hbm2ddl.auto" value="update" />      </properties>    

I was wondering if it is possible to get the user and password values from System-properties.

Context: I have a Java Webapp which is packaged as .war file. In the war file, I don't see said xml anywhere, but I want the war to work for system with different mysql credentials too, by just modifying some configuration file in the war.

No comments:

Post a Comment