1

I am using persistence.xml where is my db connection. And in log4j.xml I have given persistenceUnitName="JPAloggingPersistenceUnit" which is in persistence.xml so it will take database connection from persistence.xml but which is hardcoded.

So I wanted make my persistence.xml dynamic which take connection from properties file.

I want to make persistence.xml dynamic which reads file from property file; like using ${username} as key in persistence which take from properties file.

In log4j2.xml I have mentioned <JPA name="db-log" persistenceUnitName="JPAloggingPersistenceUnit" entityClassName="com.majesco.digitalio.logentity.JpaLogEntity" />.

In persistence.xml I have mentioned below like <persistence-unit name="JPAloggingPersistenceUnit" transaction-type="RESOURCE_LOCAL">.

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
Ganesh
  • 31
  • 5
  • Which JPA vendor do you use? Ho do you initialize it (java code, spring, app server, etc?) If java, can you post some code? – ike3 Sep 20 '16 at 08:53
  • Thanks for your reply sir....! In log4j.xml And am using sir please help if possible. – Ganesh Sep 20 '16 at 10:01
  • I dont want to used persistence.xml or trying to make persistence.xml dynamic which will take connection from properties file. but my log4j.xml entry always taking connection from persistence.xml . – Ganesh Sep 20 '16 at 10:04
  • Follow this link , i believe this is what you are looking for. http://stackoverflow.com/questions/19170876/persistence-xml-to-import-database-parameters-values-from-properties-file – mhasan Sep 20 '16 at 10:05
  • thnx for reply sir but this was not worked for me ....! The link which you suggest exactly I am looking for to make persistence.xml externalised from property file. There are lot student and developer facing this problem but yet nobody was successful to resolve this issue . But I know you will definetly help me..! – Ganesh Sep 20 '16 at 12:00
  • Anybody have any resolution for this problem ..? Please reply friend...! – Ganesh Sep 21 '16 at 08:24
  • Hi mhasan sir do you have any idea about this issue ? Can you please suggest if u have any approach. – Ganesh Sep 22 '16 at 06:47

0 Answers0