In my project i want to change database connection dynamically, but at a time one database connection should present.So how can i change Database connection without restarting server. Is there any way in hibernate to change Database connection without restarting server?
Asked
Active
Viewed 613 times
1
-
you have to do it manually. it will go like configure multiple connection and use any of them according to your conditions. – Saif Apr 06 '15 at 09:53
-
1You can configure multiple persistence units and switch them to your willing on runtime. If you cannot declare multiple PUs as they are unknown on compile time, you can also configure them on runtime from code, but it will take a lot of boilerplate code. – Antoniossss Apr 06 '15 at 10:09