1 Reply Latest reply on Mar 21, 2007 4:49 AM by Martin Ganserer

    Several clients connecting to an EJB application in JBoss

    Santiago Faci Newbie

      Hello,

      I am developing an EJB application in a JBoss application server. Several clients (Swing clients) have to connect to this application to load, modify insert data in a database (using entity and session beans).
      But I have a problem to solve. When two or more clients are accessing to the same row, one of them can modify this row and, then, the others are working with an out-of-date data of the row (dirty read).

      ¿It's possible to notify to all connected clients that some row (or rows) have changed? ¿And to update the data of these clients from server?

      Thank you very much

        • 1. Re: Several clients connecting to an EJB application in JBos
          Martin Ganserer Novice

          Hi,

          I don't think that the EJB3 lock strategies can help you further especially when working with rich clients! It's up to you to implement it by yourself!
          I had the same problem too and I solved it in a very easy way:
          In our last project we had one entity that was in danger of being changed by different users at the same time. As the client was a SWING tool, very long transactions could occur! We added two attributes to this entity. One that holds the lock date and another that
          references the user which locked the row (= entity). If one user selects the "row" for update the lock date and the user will be saved in the fields. If another user wants to open the recordset for update he will get a message that the row is locked.

          Hope that this helps you!