Hi guys,
I'm using NH 1.2 release for a web app where the requirement is to load everything from DB at Application_Start, so even the many-to-one references are not lazy.
You can guess that I work with detached objects since I load all at one time in the application lifecycle; the problem is that I often I lock some object in order to commit changes but the lock goes by cascade and when it reaches the "one" from many-to-one not lazy relation I get a "NHibernate.TransientObjectException : cannot lock an unsaved transient instance: [...]".
session.Lock(something, LockMode.None);
I realise that the "one" exists from another session, but anyway, it should be IsSaved. All works like a charm if I commit in the same session that queried the objects.
Have any ideas?
Thanks
|