You attach the object to a different session. Dirty checking uses
first-level-cache which is tied to the session. NH must therefore perform an
update to assure that there has not been any changes to the object before it
was attached to the session.
The "AND Version = @p3' AND Path = @p1" part is NH's optimistic locking. If
the data has changed, 0 rows are affected and NH detects an concurrent
change to data.
To save you SQLServer from being killed you have to use a lazy loaded
1-on-1-relation between object and BLOBs. See the NH FAQ blog for a tutorial
on this.
-Markus
2008/11/19 Dan Bunea <[EMAIL PROTECTED]>
> Hi,
>
> In our application, there was a reauirement to have Guids as Ids. However
> we have an odd behaviour: havina a class Texture, with and Id:Guid and a
> property Path:string if I do something like:
>
> Texture t=null;
> using(SessionScope s1 = new SessionScope())
> {
> t = Texture.Find(someTexture.Id);// we added it before
> }
> using(SessionScope s1 = new SessionScope())
> {
> t.Save();
> }
>
> on t.Save() it will do an update such as:
>
> UPDATE Textures SET Version = @p0, Path = @p1, WHERE Id = @p2 AND Version =
> @p3' AND Path = @p1,
>
> Problems:
>
> 1. Since NH has dirty checking why does it even perform the update since
> nothing is changed.
> 2. Even if something has changed why isn't the update only using the Id
> like
>
> UPDATE Textures SET Version = @p0, Path = @p1, WHERE Id = @p2
>
> and not all the properties??
>
> Thanks,
>
> Because of problem 1 we have a multitude of UPDATES being performed some
> with BLOBS and it is killing the sql server.
>
>
> --
> Dan Bunea
> http://www.danbunea.ro
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---