Depends on your intent. I don't understand the intent here, so hard to say.
{{SessionFactoryObserver}}, as it seems to imply pretty intrinsically imho, is an observer for the {{SessionFactory}} starting and then closing. Seems like a good fit for what you need. Not sure what makes {{SessionFactoryObserver}} "hacky" aside from Emmanuel's gut. It exists for a purpose.
Like I said it really depends on more data then is discussed here.
|