Hello Maulin
Let me think if i have understood your requirement correctly.
You have hibernate.cfg.xml which has entries varying wrt to environment.
1. Mostly it will be DB Connectivity things
2. Some tags specific to environment.
Questions
1. Let us assume you pack the configurations in tar or jar and give to deployment team.
Will you repack the jar for every environment or is it one time packing and
environment team keeps deploying in different environment.
for ex
you pack configurations for QA environment.
Once
testing completes, will you give a release for prod or will you use the qa environment TAR.GZ for production deployment.
Case 1
If same tar to be used across environment, and settings to be changed localised to that environment.
Solution1.
Step 1. Let us take hibernate.cfg.xml, it has
Now this value varies wrt to varies environment.
Step 2. Create a Project called projectResources
with this file as hibernate.cfg.xml.template
edit the file in such a way
Step 3.
Have a properties file
local_db_connection_string=jdbc:Oracle:thin:@x.x.x.x:x:SID
Note: This properties will be residing in every environment, carrying values wrt to that environment.
QA local.properties will be
local_db_connection_string=jdbc:Oracle:thin:@x.x.x.x:x:QASID
PRod local.properties will be
local_db_connection_string=jdbc:Oracle:thin:@x.x.x.x:x:PRODSID
Step 4.
Now while giving a release , we have to pack the template file instead of hibernate.cfg.xml, in this way
we have a release generic to all environment
Step 5.
Now we have to use small program using velocity to replace the macro with values actual before deploying.
Check velocity how to replace macro with values.
pS: Any information /help on this let me know