Hello and thanks for the answer. I do use identity for my master (PriceChangeCase) but I do not use it for my details (PriceChange). So batching do work, it is only that saving the collection of PriceChanges by them selves is soooooo much faster than saving them together with the root aggregate (PriceChangeCase) (using cascade for the set mapping in the mapping of my master).
So the question really is if this is by design or if I am doing something else that is wrong? On 1 Maj, 00:01, Jason Meckley <[email protected]> wrote: > you are using identity (a database POID generator) which cannot take > advantage of batching. Only the client POID generators (hilo and guid) > can take advantage of batched inserts. this is due to the nature of > how/when an id is assigned to an entity and how the UOW operates with > client vs database POIDs. if you google NHibernate POID you will find > 2 posts by Fabio on the topic. > > On Apr 30, 3:52 pm, robcar <[email protected]> wrote: > > > > > > > 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 > > 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.- Dölj citerad text - > > - Visa citerad text - -- 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.
