Dear nHibernate developers,
Among other classes I have two classes: User and TourGroup those participate in many-to-one relationship. So User has a property TourGroup. Note: I do not need and do not implement one-to-many relationships (via collections), only many-to-one via single property. I use ADO.NET SQL queries for working with one-to-many and it is fine for me.
When I load User1 I do a refresh to see if any changes were done externally (by ADO.NET or programs running on other hosts), and it works fine. If it is a first User loaded from the database then its TourGroup1 is fresh too. But when later I load User2 which may refer to the same TourGroup1 and doing refresh on User2 I get a fresh copy of User2 but TourGroup1 may be expired, cached version of it loaded together with User1 is used. So if any external changes to TourGroup1 has been made since loading User1 they are not available in TourGroup1 object until explicitelly refreshing it like Session.Refresh(User2.TourGroup).
Reason: It is not convenient to manually refresh each object in a long hierarchy of objects like:
User2
User2.TourGroup
User2.TourGroup.PSHost
etc.
Please suggest:
1) Is it possible somehow to tell nHibernate to automatically refresh all many-to-one related objects when many side is refreshed? So when Session.Refresh(User2) would be called it would automatically refresh User2.TourGroup too.
2) Is it possible to completelly disable Session (first level) cache?
3) Is it correct that SessionFactory (second level) cache is disabled by default if no cache assemblies are placed to the bin directory and no config instructions for cache provided?
Thanks, Alex
www.aulix.com