I'm currently developing an application server which employs a "classical" 3-layered design: Persistence Layer <-> Business Logic <-> Presentation
I use NHibernator for the PersistenceLayer and the mapping works pretty well. But by design, the PersistenceLayer encapsulates the used database access lib (namely NHibernate) and adds some extra functionality like caching and thread-safety via object locking.
If code wants to load db-objects it does not directly use NHibernate. It uses the LoadObject(..) call of the PersistenceLayer I coded. All db-objects must be loaded via this call, so my code can keep track of loaded objects for caching and thread safety.
That's where things get a bit complicated.. for example if an object contains a one-to-many relation, NHibernate loads the associated objects (on demand) implicitly without the knowledge of my caching/thread-safety code.
Is there a way to gain this level of control back from NHibernate to my code ? I want to use NHibernate as much as possible, but sometimes I need a higher level of control.
Is it even a good idea to try something like this with NHibernate ?
So far, sorry for the long post ;-)
thanks for your help and greetings !
Thomas
|