Announcement Announcement Module
No announcement yet.
Transaction reduced to a specific Object Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Transaction reduced to a specific Object

    Hi everybody,
    i am building a desktop application that is talking to a spring based server app over the http invoker.

    i have a question about the transaction isolation:
    Is it possible to block access to for example getObject(id) methods while a thread is calling a delete(Object) method?
    And the transaction should only block methods that want to load an object with a specific id because otherwise all users would be blocked althoug they
    want to access objects that are not marked with "to be deleted".

    Assuming i only allow the delete(object) method when no one holds a reference to this object i need to assure that no one gains access to the object or related objects while the deletion is processed.

    Any suggestions on that? Or perhaps you have best practices for isolated object deletion.

    Thanks in advance
    Last edited by mrwhite; Jul 23rd, 2007, 05:29 PM.

  • #2
    Can't you simply lock the row?
    Last edited by karldmoore; Aug 27th, 2007, 03:48 PM.


    • #3
      This all sounds odd to me.

      READ_COMMITTED should be ok for your needs, you just need some validation in there.

      Updating a recently delete object can be solved with some validators running numerious checks, i.e does it exist, is it stale etc...

      This is much simpler then worrying about who has reference to what object...

      I wouldn't recommend adding security to getObjectById...


      • #4
        Thanks for your suggestions but what happens when a user adds an item to an object which parent has been deleted but it itselft not yet?

        You cant be sure that a "isAvaible(object)" before save(objectChild) is still valid when the thread arrives the save(objectChild).

        Is there some mechanism to do that?


        • #5
          Originally posted by mrwhite View Post
          ...but what happens when a user adds an item to an object which parent has been deleted but it itselft not yet?
          Is there some mechanism to do that?
          This is typical concurrency issue and is more common if you allow user think time or long running conversations. Just handle it the same way you would for a stale object check...


          You could have an UpdateUserValidator, in this validator you could have a validateAssociation(String id)...if the association doesnt exist then add some text to the Errors object.

          Catch a BindException on the client and do something...

          The other option is to use Hibernates validation framework to do a simpler thing...but I have found it easier to work with Springs BindException in the client.

          A third option is to not have any validators and catch the hibernate exceptions...(not recommended by myself because I believe it much easier to work again with Spring BindException and Errors objects)
          Last edited by jamesclinton; Jul 24th, 2007, 11:56 AM.


          • #6
            Other question:

            How do you delete data in heavy threaded applications without the risk to have an inconsitent database?
            Last edited by mrwhite; Jul 24th, 2007, 03:45 PM.