1

How can I configure persistence.xml for production? My question specifically concerns the definition of parameters such as user, password and bank url, for example.

I would like to not include this data directly in the file, but in an environment variable, for example.

However, it can be any other approach, except overwriting the file settings via the entity manager factory as was said in these questions 1 e 2

This restriction exists because my EntityManager is injected via @PersistenceContext. This even generated a comment

I'm using a JavaEE application with JAX-RS, Hibernate JPA and Spring MVC

Joao Albuquerque
  • 366
  • 1
  • 3
  • 15
  • It's a JavaSE application or JavaEE? If you are on a JavaEE server you should use a datasource to provide connections – areus Apr 03 '20 at 05:13
  • I edited the question and a i included: I'm using a JavaEE application with JAX-RS, Hibernate JPA and Spring MVC. However, can you detail more what you said about "use a datasource to provide connections? @areus" – Joao Albuquerque Apr 03 '20 at 14:04
  • On a JavaEE server you can define a datasource, with all the connection properties, and on the persistence.xml you only need to add the `` tag referencing the JNDI name of the datasource. – areus Apr 04 '20 at 14:57

0 Answers0