I've read a lot of posts and blogs about this issue, which essentially boils down to this: I have a database schema that is replicated across X databases, this number in practice will most likely be in the hundreds. Each database represents one corporate account entity. This structure is necessary for encapsulation of data, ease of backup, and ability to horizontally scale databases across multiple DB servers if that becomes an issue. I've come very close to accepting the fact that this can't be done with a single hibernate SessionFactory. From what I've read, the SessionFactory is "expensive to create." Once created, how expensive is it to keep around? Is it practical to think that I could have hundreds of created-on-demand session factories registered in memory which will be used by each client as necessary and expire after some period of inactivity? Has anyone else used hibernate with a multiple database setup (or even multiple tables representing each account)? How did you accomplish it? Thank you in advance!
|