mihalcea_vlad wrote:
No. The bootstrap process creates the Metadata and passes it to the SessionFactory upon instantiation. For this reason, you can not add entities dynamically to a SessionFactory, meaning that you need to recreate it from scratch.
However, the SessionFactory initialization can be done programmatically so you can recreate it whenever you have new entities that need to be registered.
Firstly, thank you very much for your gentle response.
One more question, After creating a new SessionFactory, shall I close the old one? If I do, will all the sessions and transactions related to it throw exceptions at this time? How can I get a smooth transition while trying to rebuild a SessionFactory?