Hibernate version: v. 2.1.4
Name and version of the database you are using: mySQL v4.0.16
My application needs to have the ability to connect to different mysql databases depending on the client logging into the application. In searching the forum and reading the documentaion I know this is possible using multiple SessionFactory instances and multiple hibernate.cfg.xml files but I'm don't see an exact solution to my problem.
Each database is configured identically but does not share data between customers. I'd like, however, to have the ability to specify a single hibernate.cfg.xml file that contains the mappings and other common properties used by the application and only specify a different database connection URL for the session factory. In other words, I don't want to have to create a complete hibernate.cfg.xml for each customer because if a mapping change in the .xml is required, that would end up being too many files to maintain.
Is it simply a matter of specifying a database connection URL in for the Configuration of the sessionFactory? Any examples out there?
|