You could look into enabling insert/update statement batching within
NHibernate, as outlined here:

http://davybrion.com/blog/2008/10/batching-nhibernates-dm-statements/

You may need to change your stategy for id generation though:

http://nhforge.org/blogs/nhibernate/archive/2009/05/21/using-the-guid-comb-identifier-strategy.aspx

hth

Dan


On Jul 7, 3:47 am, Michael Yeaney <michael.yea...@gmail.com> wrote:
> Thanks for the suggestion, Brian.  Believe me, I've been itching to do just
> that, but the other half of my brain has been saying "No, let the ORM do
> it's job".  I didn't think there was a way to avoid it with an ORM, but I
> had to check.
>
> The inserts are performed based on change notifications received from a file
> system that is monitored for known file types.  When a notification is
> received, the end result is that the file is read, parsed, and stored with a
> version stamp in the DB. So, ultimately, this doesn't happen ~that~ often
> (generally around 1-2 requests per second), but I just wanted to check and
> see if there were any caveats to be aware of in a scenario like this.
>
> Thanks so much!
> Michael Y.
>
> On Mon, Jul 6, 2009 at 10:07 PM, Brian DeMarzo <bdema...@gmail.com> wrote:
>
> > Thought: Override the SAVE method for the Project. Serialize your
> > objects to XML, then send the serialized XML to a sproc. Overly
> > simplistic suggestion, granted, but there's no way to avoid an ORM
> > doing individual INSERTs for each object.
>
> > That being said, how often are you creating such complex projects? If
> > it's only occasionally, is 2-5 seconds that bad? Does the time to save
> > really slow down the users, or cause locking problems on the DB?
>
> >  - Brian
>
> > On Jul 6, 4:05 pm, Michael Yeaney <michael.yea...@gmail.com> wrote:
> > > Question for the AR experts out there.  I'm working with an object
> > hierarchy
> > > that is (roughly) defined as such:
> > > Project
> > > - Has Properties
> > > - Has Categories
>
> > > Category
> > > - Has Properties
> > > - Has (Sub) Categories
> > > - Has a type (enum)
>
> > > Property
> > > - Has DataItems
> > > - Has a type (enum)
>
> > > DataItem
> > > - Has Name
> > > - Has InternalName
> > > - Has Value
> > > - Has InternalValue
>
> > > I've got everything working with AR, but the insert implimentation is
> > really
> > > bothering me. The project object(s) I'm saving to the DB contain 40 - 50
> > > categories, each with ~100 properties.  As you can probably imagine, this
> > is
> > > resulting in an * enormous* amount on INSERT's being issued to the DB
> > (over
> > > the wire), in total taking 2 - 5 seconds.  In the old days, I would have
> > > hand-rolled this insert to use XML (I'm on SQL Server 2005), and sent the
> > > entire graph in with one call over the wire.
>
> > > Has anybody run into this before, and is this "normal"?  It doesn't feel
> > > good at all...or, is there an AR optimization that I'm not familiar with
> > > that can help here?
>
> > > Cheers, and thanks for you time...
> > > Michael Y.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to castle-project-users@googlegroups.com
To unsubscribe from this group, send email to 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to