I want to read environment variables inside persistence.xml file.
Idea is that i don\'t want my database details to be read from properties file as
You could use this working example.
It gets all properties defined in the persistence.xml from the PersistenceUnitInfo instance which is obtained from the EntityManagerFactory (by using eclipseLink specific implementations). These properties get replaced with the values defined in environment variables.