hibernate - How to move the environment details outside the EAR -


Our project is a medium-sized web application that was developed using Wade 6.1 / Hibernate / Streets using RAID 7.0 That has gone into production. We currently hardcoded the IP address of the production system in the property file and database schema details in the hibernate config file.

Our customer wants us to come up with a solution to keep the environmental details out of EAR so that they can change environment / DB details in the future with opening EAR.

Any indication would be very helpful thanks.

You can use JNDI for this. You should make appropriate entries and read them in your code like this:

  reference initialContext = new InitialContext (); URL IP = (URL) initialcontact Lookup ("java: comp / env / myip");  

See articles about how to use a JNDI data source in the hibernate configuration files.


Comments