We have a Java-Hibernate based web application in which we deal with PostgreSQL database.(It is a single database having multiple schema(s) in it.)
Currently we are facing scalability issues so we have decided to split our schema(s) among multiple database.
Example:
- Previously we have database called "mydb".
- And now we split database like "mydb_1", "mydb_2", "mydb_3", so on... (As load will increase, we will create new database.)
Problem:
- How to manage multiple database from one *.cfg.xml? (We do not want to introduce multiple *.cfg.xml (for every database) every time.)
- Can this be achieved with newer hibernate version? (We are ready to upgrade our Hibernate version)
- Do we need to create pool of session factory? (I think its a bad idea and thought... :) )
Note: It would be great, if anyone can provide tutorial/document link for this.
Similar Question: Hibernate using multiple databases
(I am expecting similar kind of answer but without multiple cfg.xml :( )
(I am expecting similar kind of answer but without multiple cfg.xml :( ): look at the most upvoted answer in the question you provided : stackoverflow.com/a/5982535/201557 : it is using a single config file.