Darthy wrote:
But won't this in most cases also result in a select of the object to the database then, just like the Load() in method number 1) I stated ?
I don't believe so. NHibernate only compares the type and id of the object. By virtue of calling SaveOrUpdateCopy(), you are in essence telling NHibernate to overwrite the entity object in the session with the entity object you just gave it.
Darthy wrote:
Thinking about it, won't this always be the case with NHibernate in a web application ? For every update you need to do in a web application, NHibernate will always have to select the object before updating it ? Is there a way to avoid this ?
Not if you keep a reference of the entity around (e.g. in the ASP.NET session) from request to request. In this case, you would be working with detached entities in the postbacks. Have a read of the "Updating Objects" section of the docs:
http://www.hibernate.org/hib_docs/nhibe ... a-updating