Identity breaks batching. Use something else. On Fri, Apr 30, 2010 at 4:17 PM, Jim Geurts <[email protected]> wrote:
> Yep, it is regarding inserts, not updates in this case. > > My map files all use identity generator: > > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" > assembly="MyProject.Domain" > namespace="MyProject.Domain.Model"> > > <class name="Property" table="pm_Properties"> > <id name="Id" column="PropertyId"> > <generator class="identity" /> > </id> > <property name="Name" /> > > > Let me know if there is any other info I can provide. > > Thanks, > > Jim > > > On Apr 30, 3:44 pm, Tuna Toksoz <[email protected]> wrote: > > He means "what is your identifier strategy" > > > > Tuna Toksöz > > Eternal sunshine of the open source mind. > > > > > http://devlicio.us/blogs/tuna_toksozhttp://tunatoksoz.comhttp://twitter.com/tehlike > > > > > > > > On Fri, Apr 30, 2010 at 11:27 PM, Fabio Maulo <[email protected]> > wrote: > > > Are you talking about INSERTs ? > > > Can we see the first few lines of a mapping files ? > > > First 5 or 6 lines, nothing more. > > > > > On Fri, Apr 30, 2010 at 5:25 PM, Jim Geurts <[email protected]> wrote: > > > > >> Should have mentioned, this is using NHibernate 3.0.0.1001 > > > > >> On Apr 30, 3:20 pm, Jim Geurts <[email protected]> wrote: > > >> > Hi all, > > > > >> > I'm doing a mass save operation and NHProf is suggesting that I use > > >> > batching to help things along. I have adonet.batch_size set in my > > >> > config file and I'm also trying to set the batch size at runtime, > but > > >> > NH doesn't seem to be picking up those values. Each save command is > > >> > still processed individually. > > > > >> > I've tried the following, with no success: > > > > >> > using (var transaction = Session.BeginTransaction()) { > > >> > Session.SetBatchSize(itemsToSave.Count); > > >> > foreach (var item in itemsToSave) > > >> > Session.SaveOrUpdate(item); > > >> > Session.SetBatchSize(0); > > >> > transaction.Commit(); > > > > >> > } > > > > >> > I've also tried the following with no luck: > > > > >> > using (var transaction = Session.BeginTransaction()) { > > >> > Session.SetBatchSize(itemsToSave.Count); > > >> > foreach (var item in itemsToSave) > > >> > Session.SaveOrUpdate(item); > > >> > transaction.Commit();} > > > > >> > Session.SetBatchSize(0); > > > > >> > My configuration file looks like: > > > > >> > <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> > > >> > <session-factory name="MyProject"> > > >> > <property name="dialect">MsSql2008Dialect</property> > > >> > <property > > > > >> > name="connection.provider">NHibernate.Connection.DriverConnectionProvider</ > > >> > property> > > >> > <property > > >> > name="connection.driver_class">NHibernate.Driver.SqlClientDriver</ > > >> > property> > > >> > <property name="adonet.batch_size">16</property> > > >> > <property name="generate_statistics">true</property> > > >> > <property > > >> name="current_session_context_class">web</property> > > >> > <property > > > > >> > name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, > > >> > NHibernate.ByteCode.Castle</property> > > >> > <mapping assembly="MyProject.Domain"/> > > >> > <listener class="MyProject.Domain.SaveEventListener, > > >> > MyProject.Domain" type="save" /> > > >> > <listener class="MyProject.Domain.SaveEventListener, > > >> > MyProject.Domain" type="save-update" /> > > >> > </session-factory> > > >> > </hibernate-configuration> > > > > >> > What am I doing wrong? > > > > >> > Thanks, > > > > >> > Jim > > > > >> > -- > > >> > 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]<nhusers%[email protected]> > <nhusers%[email protected]<nhusers%[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]<nhusers%[email protected]> > <nhusers%[email protected]<nhusers%[email protected]> > > > > >> . > > >> For more options, visit this group at > > >>http://groups.google.com/group/nhusers?hl=en. > > > > > -- > > > Fabio Maulo > > > > > -- > > > 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]<nhusers%[email protected]> > <nhusers%[email protected]<nhusers%[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]<nhusers%[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]<nhusers%[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.
