Timeout Saving on a Transaction


Author
Message
Larry Caylor
Larry Caylor
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K
In my application I'm having an issue with saving BOs that have a parent/child relationship on a transaction. To simplify things for testing I created two BOs, ParentBO1 and ChildBO1 and defined a parent/child relationship between them. I dropped the BOs on to a standard SF form and excluded them from the form save, delete, undo etc. form events. I'm not using any stored procedures and have concurrency checking as OptimisticAllFields.

On the form I have the following save method:

Private Sub SaveAllOnTransaction()
  Try
    BusinessLayer.TransactionBegin("", Data.IsolationLevel.ReadCommitted)
    '-- Save objects
    Me.ParentBO1.Save(True)
    Me.ChildBO1.Save(True)
    '-- Commit Transaction
    BusinessLayer.TransactionCommit("")
  Catch ex As Exception
    '-- Rollback transaction
    BusinessLayer.TransactionRollback("")
    '-- Show inner exception
    MessageBox.Show(ex.InnerException.Message)
  End Try
End Sub

The test form simply loads the Parent and Child BOs, places the Parent in edit mode and displays a list view of child objects that may be selected for editing or new child objects may be added using a ChildFormDialog.

If I simply edit the ParentBO and save, everything works okay. If I leave the ParentBO alone (Although it is marked as IsDirty since it was placed in editing mode) and modify or add a child record and save, everything works okay. However if I modify both the Parent and Child BOs and try to save, the program hangs and eventually an exception is thrown saying "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.".

Modifying the save method as follows eliminates the error.

   '-- Save objects
   If Me.ChildBO1.IsDirty Then
       Me.ChildBO1.Save(True)
   ElseIf Me.ParentBO1.IsDirty Then
       Me.ParentBO1.Save(True)
   End If

It would appear that the framework is trying to save the ParentBO twice, if there are actual changes to the ParentBO and ChildBO causing an error when saving the Parent a second time under a transaction. I know that the framework is designed to save the Parent when a child is saved. but it is not recognizing that the child has already saved the parent when Save(true) is called on the parent. This is only an issue when objects with a parent/child relationship are saved on a transaction. I'm using v1.61

-Larry

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Larry Caylor - 17 Years Ago
Larry Caylor - 17 Years Ago
Paul Chase - 17 Years Ago
Larry Caylor - 17 Years Ago
Paul Chase - 17 Years Ago
                 What about your boat now?
Ivan George Borges - 17 Years Ago
                     It must be adrift now ;)
Greg McGuffey - 17 Years Ago
                         The moreI thought aboutI realizedit would be bettermail it to...
Paul Chase - 17 Years Ago
                             COOL! That episode I want to see! :D
Trent L. Taylor - 17 Years Ago
Larry Caylor - 17 Years Ago
Ivan George Borges - 17 Years Ago
Larry Caylor - 17 Years Ago
Trent L. Taylor - 17 Years Ago
                 Cement Truck was awesome....
Paul Chase - 17 Years Ago
StrataFrame Team - 17 Years Ago
                         Doesn't he get a prize?
Paul Chase - 17 Years Ago
                             Well, there is a cement truck that would be easy to mail...it's in...
Greg McGuffey - 17 Years Ago
Larry Caylor - 17 Years Ago
Trent L. Taylor - 17 Years Ago
                 Here we go again... :exclamationmark:
Ivan George Borges - 17 Years Ago
                     ROFL
Greg McGuffey - 17 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search