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

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
Looks like this one got overlooked. Should the framework handle parent/child objects being saved on a transaction without having to track which object is dirty or is that the developers responsibility? I'm assuming what is happening is the parent object gets saved once by the child object, but is not comitted. When save(true) is called on the parent the second time, it's blocked since it's trying to update data that's alreadly locked by the current transaction and eventully the update request times out.

-Larry

Paul Chase
Paul Chase
Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Larry,

I ran into exactly the same issue , was there any response on this? 

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
Hi Paul,

Somehow they missed this one. I just asked about it in another post and they said they would take a look at it.

-Larry

Paul Chase
Paul Chase
Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Thanks Larry

I was in the process of tying a rope to my machine (To better use it as an anchor for my boat) when I noticed that this was the same issue I was having. 

Thanks for saving me the time figuring out what was going onSmile

Paul 

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
What about your boat now?
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
It must be adrift now Wink
Paul Chase
Paul Chase
Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
The more I thought about I realized it would be better mail it to MythBusters and see if they could blow it up.w00t  
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
COOL!  That episode I want to see! BigGrin
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
Lately MythBusters is about the only thing my cable provider has that is worth watching. I've considered buying a plasma TV now that they're so cheap, but there seems to be a shortage of good "software" to go with it Wink
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search