Essentially, you'll want to create a new SessionFactory for each schema you have, and programatically peg incoming requests to the right SessionFactory. I'm guessing transactions won't go across multiple databases, right? Like when someone gets a schema, they're stuck with that one for the life of the transaction?
For more complicated scenarios, there is a project called Hibernate Shards that mitigates access to multiple databases through what appears as one session manager.
_________________ Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?" http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials
|