We are doing something like that in our project. Here is a summary of the procedure:
1. We have a template file that contains the basic structure of a Hibernate XML mapping file. See
http://base.thep.lu.se/browser/trunk/sr ... awData.xml
2. In our startup code we read in this template file as an XML Document object. We are using JDOM for this. Once we have it as a Document it is easy to manipulate attributes, for example, the table-name. We are also adding <property> definitions for some additional properties (defined by a system admin in a different XML file).
The relevant part of this code can be found at
http://base.thep.lu.se/browser/trunk/sr ... .java#L297
3. The last part simply registers the manipulated Document with the Hibernate configuration: Configuration.addDocument().
4. Once everything is setup the configuration is used to create the SessionFactory:
http://base.thep.lu.se/browser/trunk/sr ... .java#L185
I hope you can make some use of this information.