Transaction Issue

Posts   
 
    
Posts: 87
Joined: 17-May-2011
# Posted on: 12-Oct-2011 11:56:06   

Hi there I have a Contact Entity which has it's two types of related collection one is Contact Address and other is Contact Email. Now what I am doing on each update first I am saving the contact entity ,then I am deleting both types of it's related collection's entities then adding new enties to each of the collection to save them all I am implementing whole of the scenerio in singular transaction the algo looks like as follows

1)otransaction.Add(oContactEntity); 2)otransaction.Add(oContactAddressCollection); 3)otransaction.Add(oContactEmailCollection); 4)oContactEntity.Save(); 5)oContactAddress.DeleteMulti(filterForDeletingRelatedEntity); 6)Add New Entities to oContactAddress 7)oContactAddress.SaveMulti(); 8 )oContactEmail.DeleteMulti(filterForDeletingRelatedEntity); 9)Add New Entities to oContactEmail 10)oContactEmail.SaveMulti();

11) Commit if run without exception else rollback

Now my problem here is that after step '5' I am unable to save entites . It is giving timeout exception which is possiblly the lock taken by the transaction( because the code runs successfully without using transaction). The isolation level is serializable. I need to do all this in a single transaction How do I Implement all this, I got stuck here confused . Kindly help me out!

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 12-Oct-2011 16:08:32   

Is the oContactAddressCollection same as oContactAddress? Or are these 2 different objects?

Could you please post a simple code snippet.

Posts: 87
Joined: 17-May-2011
# Posted on: 12-Oct-2011 17:42:11   

Yes they are same, typed incorrectly stuck_out_tongue_winking_eye

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 12-Oct-2011 18:05:48   

Could you please post a simple code snippet.