From: Colin S. <col...@ex...> - 2003-10-24 18:50:53
|
(I think your email was HTML only, I had to actually copy and past it, reply copied all the HTML tags). I think this would work ok. All usage of properties in afterPropertiesSet is qualified by 'if ! null', so one template method like this would allow extension on any of them... Colin Juergen wrote: > >>> Alef, I'd like to keep the final afterPropertiesSet -- it's too easy to break superclass functionality if overriding that and not properly doing super calls. Currently, you could override newSessionFactory a la: protected SessionFactory newSessionFactory(Configuration config) { // add the mapping resources programmatically config.addResource("myMappingResource", Thread.currentThread().getContextClassLoader()); return super.newSessionFactory(config); } Of course, it might make sense to introduce a separate post-processing callback, to be invoked by the standard afterPropertiesSet method right before the newSessionFactory call: protected void postProcessConfiguration(Configuration config) { // add the mapping resources programmatically config.addResource("myMappingResource", Thread.currentThread().getContextClassLoader()); } What do you think? I guess such a call back wouldn't hurt anyone, and it is easier to override for post-processing purposes. Juergen |