What I did is create a varient of the HibernateUtil class that is described in the Caveat Emptor demo application (
http://caveatemptor.hibernate.org/). Basically, I changed so that it would create
n-number of SessionFactories and I can access them by name. So rather than say:
Code:
SessionFactory factory = HibernateUtil.getSessionFactory();
I could do either:
Code:
SessionFactory factory = HibernateUtil.get{name.goes.here}SessionFactory();
Or prehaps a bit more flexible:
Code:
SessionFactory factory = HibernateUtil.getSessionFactory("factoryName);
I also changed the initialization to that it could read a specific URL to load different config files. I could not use the static initialization block that the original HibernateUtil uses to inialize the factory. But about 90% of the configuration code you'll need is already in HibernateUtil, you'll just need to adapt it to you needs. Hope this helps.
Ryan-