This is the situation:
I have a J2EE application, when there is the first call to Hibernate I build a configuration object, from which I build a sessionFactory object which I store in JNDI ... this first step maps all the classes (and of course is quite slow)
On the second call I get my session factory from JNDI ... and everything is fast.
My problem is that I have to add a new class to map a run time, after the configuration object is build and throw away ...
I've seen that sessionFactory has the evict method to remove an old class, but how can I add a new one?
Should I keep in some cache the configuration object and make a new sessionFactory from this one (after adding the new mapping)? Is this a dangerous operation to make while the application server is working, and so there are many other users who calls hibernte fuctions?
Any help will be appreciated
Regards
Alessandro Rizzi
|