Performance is better, because NH it's executing an insert instead of
an update, but I can't make the cascade="all-delete-orphan" to work.
Here is the mapping:
<class name="Document">
<id name="Id">
<generator class="guid.comb" />
</id>
<many-to-one name="BinaryDocument" cascade="all-delete-orphan"
access="property" />
</class>
<class name="BinaryDocument" lazy="true">
<id name="Id">
<generator class="guid.comb"/>
</id>
<property name="Data" type="BinaryBlob" length="20971520"/>
</class>
I'm not sure, but I think cascade="all-delete-orphan" is only
applicable to collections (i.e. one-to-many relationships).
On Wed, Sep 29, 2010 at 7:52 PM, Nexus <[email protected]> wrote:
> Just as i thought still updating try this its in pseudo
>
> Document(class)
>
> BinaryDocument(class) Binary get;set; [Mapped trough many-to-one lazy
> with cascade="all-delete-orphan"
>
>
> BinaryDocument
> Byte[] Data { get;set; }
>
>
> So changing binary data means
>
> var document = Session.Get<Document>();
> var binarydoc=new BinaryDocument([RawData]);
> document.Binary = binarydoc;
> Session.Flush
>
> Should help alot ;)
>
>
> On 29 sep, 17:21, Juanma <[email protected]> wrote:
>> My mapping is this:
>>
>> <class name="MasterData">
>>
>> <id name="Id">
>> <generator class="identity"/>
>> </id>
>>
>> <property name="Version" not-null="true"/>
>> <property name="Data" not-null="true" type="BinaryBlob"
>> length="20971520" />
>>
>> </class>
>>
>> The time is 15448ms (i.e. ~15 seconds). My regional settings are
>> Spanish, so the point is the group separator, not the decimal
>> separator.
>>
>> And the sql statement being issued by NH (taken from NH log) is:
>>
>> UPDATE MasterData
>> SET Version = @p0, Data = @p1
>> WHERE Id = @p2; @p0= '83a6dcb8-e67d-4df2-b532-ea54c87dbb96', @p1 =
>> 'System.Byte[]', @p2 = '1'
>>
>> Thanks a lot for your help.
>>
>>
>>
>> On Wed, Sep 29, 2010 at 5:10 PM, Nexus <[email protected]> wrote:
>> > Euh i hope you are have an entity(class mapping) mapped around the
>> > binary array otherwise you still are doing same thing, which is
>> > updating
>>
>> > Another question can you give me exact statement that is executing
>> > (TSQL) and is your database on a remote server or somehing and is the
>> > timing really 15.448 ms better said 15,5 ms ?
>>
>> > regards
>>
>> > On 29 sep, 11:32, Juanma <[email protected]> wrote:
>> >> That's what I'm doing. I'm just creating a new byte[].
>>
>> >> Anyway, the problem is not with the dirty check. I've uploaded an
>> >> snapshot of a dotTrace session (http://twitpic.com/2t0lo5/full). That
>> >> snapshot is taken after update the varbinary field from 3 bytes to
>> >> 2MB. As you can see, the most expensive operation is
>> >> SqlCommand.ExecuteNonQuery. However, the same ExecuteNonQuery in raw
>> >> sql takes less than a second.
>>
>> >> On Tue, Sep 28, 2010 at 10:59 AM, Nexus <[email protected]> wrote:
>> >> > Juanma,
>>
>> >> > As a general advice don't update blobs think of them as
>> >> > ValueObjects(DDD). Try removing the binarydocument reference (3bytes
>> >> > version) and adding another (8MB version), should improve speed
>> >> > drasticly due to dirty check
>>
>> >> > --
>> >> > You received this message because you are subscribed to the Google
>> >> > Groups "nhusers" 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
>> >> > athttp://groups.google.com/group/nhusers?hl=en.
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups
>> > "nhusers" 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
>> > athttp://groups.google.com/group/nhusers?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" 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/nhusers?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"nhusers" 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/nhusers?hl=en.