I have a situation where I have several different configurations for my hibernate sessions, mainly revolving around different interceptors and filters. I also sometimes want the session to be event scoped and other times to be conversation scoped.
At the moment I have something similar to the ManagedHibernateSession which handles closing the session on the @Destroy of the component. This is all fine.
But now because I have all these different configuration options I don't really want to have to define an entry in component.xml for each property combination. I want to be able to do something like this in code...
And have the a Session returned that will be created on demand with the correct configuration AND stored in the relevant Seam context so it is cleaned up in the right place.
Almost like wanting to add arbitrary objects to the Seam contexts and have them cleaned up like normal Seam components.
I can't see anyway of doing this right now as the Seam stuff all revolves around the Component entry being in place. Is there any way of making this a bit more dynamic. I thought about having a Seam component per scope that stores a list of objects and does the relevant lifecycle stuff do them (calling a destory method for example).
Has anyone else tried to do something like this or have a better way within Seam of doing this?