What about using XML External Entity references? I am not highly expert on this, found the information on the "Java Persistence with Hibernate" book, Chapter 3, Pg. 136-137.
Step 1: Define a globals.dtd file where you define external XML entities like the following:
Step 2: Include the global dtd file containing entities into you DOCTYPE definition in hibernate.cfg.xml file.
Step 3: In the hibernate.cfg.xml file refer those entities as replaceable parameters (hope following formats well!).
Step 3: Make sure the globals.dtd file is there on the classpath for the parser to find it out.
Step 4: We have an
Ant build file to include the correct globals.dtd file for different environment and to build the corresponding JAR file at deployment time.
And good news is that it worked for us. Hope this helps.
- Susanta
[ November 05, 2007: Message edited by: Susanta Chatterjee ]