Scott, I remember now. This idea of context (not having access to the in-flight SessionFactory) is what killed this idea in my mind the last time it was discussed. Martin, as a developer of CDI/Weld, an entire spec/library based on the importance of context/scopes, I think you'd understand how important the context is here Yes sure we could use statics. Funny how often that is the recommendation when there is just simply not a good solution But the bottom line is that using statics for this is just that : not a good solution. Could it work? Sure, in the optimistic case we could make that to work. But when things break down how are we ensuring that Hibernate is given the notice/opportunity to clean up these statics? IMO the only REAL solution is for CDI to add the ability to add a listener directly through the BeanManager. |