Active transaction required for write operation

5 posts, 0 answers
  1. Alec
    Alec avatar
    43 posts
    Member since:
    Mar 2009

    Posted 06 Apr 2009 Link to this post

    When I have added an object, and then retrieve it again and updated. That exception shows up.

    What does this mean?
  2. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 06 Apr 2009 Link to this post

    Hi Alec,

    All operations that make changes to the database are encapsulated within a transaction. This ensures that all changes are committed at once to the database. It also provides the ability to rollback the changes if something bad happens, so the database will not be polluted. Transactions are managed by the ObjectScope.Transaction property and its Begin, Commit and Rollback methods. Note that only one transaction can be active at the same time for each object scope instance. I believe you will find this Knowledge base article useful.

    Kind regards,
    Alexander
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  3. DevCraft banner
  4. Nathan Heberley
    Nathan Heberley avatar
    13 posts
    Member since:
    Nov 2005

    Posted 10 Aug 2009 Link to this post

    What if you want to make an alteration to an object whichyou are not going to persist?

    In my sinario I'm binding Hierarchical data to a panelbar, I have to knock off the root Item and then update the root items children to contain a parentID value of 0 so that the auto binding will work.

    I have no intention of persisting these values but I get the error mentioned.

    Do you have a solution ?



  5. Nathan Heberley
    Nathan Heberley avatar
    13 posts
    Member since:
    Nov 2005

    Posted 10 Aug 2009 Link to this post

    I have founbd a solution bu I would prefer to find an alternative.

    I rebuilt the returned List and created new objects for each one I wanted to alter.
    This solution is fine for the particular use but I would like to know if there is an alternative for the case where there are allot of objects that need alteration. 
  6. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 11 Aug 2009 Link to this post

    Hi Nathan Heberley,

    The only way to edit an object out of transaction is when the object has not yet been added to an ObjectScope. For all other cases, an active transaction is necessary.
    In order not to persist the alterations to already existing in the scope objects, you can use a transaction and call Transaction.Rollback() at the end to cancel the changes. Hope I understood you correctly.

    Best wishes,
    Alexander
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top
DevCraft banner