I am quite new to NHibernate and might be doing things wrong but am
facing a problem with my current mapping setup and performance when
saving.
I have enabled batch-size <property name="adonet.batch_size">100</
property>) and then I save my root aggregate and cascade my them from
my master to my set of detail rows.
The problem occurs when saving. Saving 5000 master entities with one
detail row each (total of 10000 objects) takes 2 min 30 seconds.
If I instead save all my 5000 master entities by them selves and then
all my 5000 detail rows by them selves, it takes some 24 seconds.
Is this by design or am I doing something nasty and wrong?
My mapping looks like this:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="Entities" namespace="Entities">
<class name="PriceChangeCase" table="[PriceChangeCase]">
<id name="PriceChangeCaseId" column="PriceChangeCaseId"
type="System.Int32" unsaved-value="0">
<generator class="identity"/>
</id>
<property name="EffectiveDate" column="EffectiveDate" not-
null="true" type="System.DateTime" insert="true" update="true"/>
<property name="Name" column="PriceChangeCaseName" not-null="true"
type="System.String" insert="true" update="true"/>
<many-to-one name="Currency" class="Currency" fetch="select" not-
null="true" outer-join="auto" insert="true" update="true"
unique="true">
<column name="CurrencyId"/>
</many-to-one>
<many-to-one name="Owner" class="Buyer" fetch="select" not-
null="true" outer-join="auto" insert="true" update="true"
unique="true">
<column name="BuyerId"/>
</many-to-one>
<set name="PriceChanges" inverse="true" cascade="all-delete-
orphan" lazy="true" fetch="subselect" generic="true">
<key>
<column name="PriceChangeCaseId" not-null="true" />
</key>
<one-to-many class="PriceChange" />
</set>
<property name="Status" column="PriceChangeCaseStatusId" not-
null="true" insert="true" update="true"/>
<property name="Comment" column="Comment" not-null="false"
type="System.String" insert="true" update="true"/>
</class>
</hibernate-mapping>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="Entities" namespace="Entities">
<class name="PriceChange" table="[PriceChange]">
<id name="PriceChangeId" column="PriceChangeId"
type="System.Int64" unsaved-value="0">
<generator class="hilo"/>
</id>
<many-to-one name="PriceChangeCase" column="PriceChangeCaseId" not-
null="true"/>
<many-to-one name="Price" lazy="proxy" cascade="none"
class="Price" fetch="select" not-null="true" outer-join="auto"
insert="true" update="true" unique="true">
<column name="PriceId"/>
</many-to-one>
</class>
</hibernate-mapping>
--
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.