Thanks again.
That would be a fair answer if the Configuration could be reconstructed by the application using the SessionFactory. However, in the case of the HARDeployer, the Hibernate MBean constructs the Configuration based on the HarUrl, and then discards that Configuration. The application using the SessionFactory cannot access the Configuration used to build the SessionFactory to mutate it, or to do anything else with it for that matter.
My hybrid Hibernate MBean registers the Configuration with JNDI (in addition to the SessionFactory) so applications can get it.
May I be so bold as to suggest that the SessionFactory deep clone the Configuration used to build it, and to provide an accessor method to return a deep clone of that Configuration?
What if a Configuration used to build a SessionFactory is being modified by another thread while the SessionFactory being built is using it? After all, as you mention, it is mutable. Of course, that would probably never occur (yeah, right), but providing a synchronized deep clone method on Configuration would allow the SessionFactory to get a private and immutable copy of that Configuration.
Ralph Harnden
|