New Posts New Posts RSS Feed: Question on saving records
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Question on saving records

 Post Reply Post Reply
Author
BillG View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 05-Dec-2007
Location: Monroe, MI
Posts: 233
Post Options Post Options   Quote BillG Quote  Post ReplyReply Direct Link To This Post Topic: Question on saving records
    Posted: 02-Dec-2013 at 10:58am
I have a coroutine where one of the parts of it loops through a collection and for each record in the collection (ex. member) creates a new entity of type (payment). There could be anywhere from several hundred to several thousand records that have to be created. As each payment row is created should I save it one at a time to the database or add it to the current entity manager cache and save the whole cache at once?
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 02-Dec-2013 at 11:24am
If you need everything in a single transaction, then you'll have to save all changes at one time.  I assume you're worried about performance when saving several thousand entities at once - it should be doable, although you might need to modify some timeouts. 
 
Saving individually would work too.  DF2010 supports partial save, so that's one option.  Another is to use a separate EM for each save.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down