Hi,
I am exploring on dynamically modify some tables' structure on runtime. Some expert solutions that I found are to build multiple SessionFactory, and always use the latest factory for latest hibernate mapping.
The concept in my mind is to have a independant SessionFactory for each dynamic table, and whenever there is update to a table structure, the app will shutdown the corresponding SessionFactory and re-create a new one with latest mapping.
My question here is how to ensure no other users are holding active session when I close the factory, to avoid any exception (e.g. somebody try to insert a record with old mapping). Does hibernate provide any method for such kind of checking or I have to build my own mechanism? As I am new to hibernate, my approach may not be the best and I am open to any other good suggestion :)
Thanks.
|