rimmele7 wrote:
Hy Jonathan,
does your code run on more than one JVM?
It can, but that is not a sticking factor at this point. When you are building a specific application you will know when it makes sense to keep sessions open for specific types of business objects, and transactional for others.
The challenge I am facing is the fact that Hibernate is being used as a generic persistence agent in an application framework that is intended to be used by other developers. This is not a trivial framework in that it encompasses more than just a presentation layer ('ala Struts) or rule management (Drools), etc.
The specific challenges that I am seeing are situations where Hibernate provides functionality that is also part of my framework (state management, object creation, object reference integrity, etc). Since Hibernate is only one possible persistence option I am in a position where I have only limited flexibility to modify how the framework operates in order to get a smooth integration with Hibernate. So things like on/off switches and places where I can hook into Hibernate functionality to do things are of more importance to me than someone doing a specific vertical application.
Christian, thank you for your feedback on this topic. Please bear in mind that although I may be a beginner at the Hibernate API, I am not a beginner at O/R mapping functional issues. I wrote an article discussing the challenges of O/R mapping 6 years ago when the company I was working for created their own proprietary O/R mapping solution.
In summary, I believe that I have the answer to my question, which is that there is not a readily available hook in place that will allow me to perform work in the middle of the lazy initialization process.
Thanks to everyone who participated in this conversation, and I am looking forward to the next discussion.