knoll wrote:
Hi,
Why don't you try to use ant?
For example, in your hibernate config file you would have:
Code:
<property name="connection.url">@database.jdbc.url@</property>
Then you define a property file having a property called:
Code:
database.jdbc.url=jdbc:mysql://localhost/db
Then you have an ant target so made:
Code:
<replace dir="${root.distribution.dir}\config\Project" token="@database.jdbc.url@" value="${database.jdbc.url}"/>
And finally, you would call your script so:
ant -f build.properties -propertyfile ../install.properties
Correct me if I'm wrong, but if I do that you said, I still needing to build my project right?
My idea is: build one time, later I just need to put a configuration file in a specific directory, and do deploy. So if I'm changing from a dev environment to another, i.e. production, then I just need to configure that configuration file and then deploy my project.
I've already tried this:
Code:
protected SessionFactory factory;
-----------
File externalFile = new File("/external.cfg.xml");
factory = new Configuration().configure(externalFile).buildSessionFactory();
But looks that hibernate doesn't read every time that I change my /external.cfg.xml file..