*Exception Line:*

var retVal = query.Where(() => !realtyFileAlias.IsDeleted && realtyFileAlias
.TypeId == (int)RealtyFileType.Image)
.SelectList(builder => builder .Select(file => file.RealtyId)).List<int>();





update for other tables that are not related in these tables mapping. 
Tables: Package and Account

There are update processes for these tables before the query below.

*Mapping*:
Realty
...
HasMany(x => 
x.Files).KeyColumn("RealtyFileRealtyID").Inverse().Cascade.All().Not.LazyLoad().ExtraLazyLoad();
...

RealtyFile:
...
References(x => 
x.Realty).Column("RealtyFileRealtyID").Not.Nullable().Not.Insert().Not.Update();
...

And there is a topic about this. Can you check it also please?

https://stackoverflow.com/questions/8350855/batch-update-returned-unexpected-row-count-from-update-actual-row-count-0-exp/8363322


i modified the query for running on single table, Realty, for checking; and 
there is not any exception.



27 Eylül 2018 Perşembe 21:52:24 UTC+3 tarihinde Oskar Berggren yazdı:
>
> Which line exhibits the exception, what other tables are updated and what 
> are your mappings?
>
> On Thu, 27 Sep 2018, 19:26 Yılmaz Demir, <[email protected] 
> <javascript:>> wrote:
>
>> *C# Code:*
>>
>> var query = Session.QueryOver<RealtyFile>(() => realtyFileAlias);
>> query = query.Fetch(sub => sub.Realty).Eager;
>>
>> query = query.Inner.JoinAlias(() => realtyFileAlias.Realty, () => 
>> realtyAlias, realty => realty.Id == realtyFileAlias.RealtyId && !realty.
>> IsDeleted);
>>
>>
>> var retVal = query.Where(() => !realtyFileAlias.IsDeleted && 
>> realtyFileAlias.TypeId == (int)RealtyFileType.Image)
>> .SelectList(builder => builder .Select(file => file.RealtyId)).List<int>
>> ();
>>
>>
>>
>>
>> *Exception:*
>> NHibernate.StaleStateException: 'Batch update returned unexpected row 
>> count from update; actual row count: 0; expected: 1'
>>
>>
>> *SQL Server Profiler Trace:*
>>
>> There are lots of UPDATE statements!!! 
>> Update statements is not related to realty or realtyfile tables. This is 
>> also interesting.
>> İ don't know why? Is there any comment please?
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "nhusers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/nhusers.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to