Discussions

Web tier: servlets, JSP, Web frameworks: Help In Design Undo/Commit command

  1. Help In Design Undo/Commit command (1 messages)

    Dear all developer
    i developing some application which connect to database engin and must have the following feature
    1- if the want to add some data into database such as add new employee or books data but thats data is not saved finnally into database untill the user enter commit commnad [press button save data ] or if the user press undo button the data not save into database

    i mean something like commit and rollback
     so how i can do that

    thanks for help
  2. Hi,
    I would recommend keeping all the new/medified data in some object (HttpSession or statefull session bean) and do the database access in one step.
    Of course, you could associate a DB connection to the user, perform work and make a commit or rollback at the end. But this would deny you the benefits of a connection pool. In this case you should also implement a timeout mechanism that is already provided in HttpSession or statefull session beans.
    Best regards, Mircea