4 Replies Latest reply on Mar 23, 2011 3:30 PM by Marcio Dantas

    Concurrency problem with entityManager.flush()?

    Thiago Assis Newbie

      The problem i have is that if more then one user tries to execute the method below,
      apparently it locks the table on the database and it stays locked, and the application becomes more and more slow. The dateQuantity variable is usually not the same for two different users, so it doesnt look like its locking the same row.
      It only happens in production.


      I'm using Seam 2.1.2 and  hibernate3.2.6.ga.
      The class and the method with the problem is this:
      The event is thrown by a controller, that passes the entityManager.
      Any idea why this could be happening?


      @Scope(ScopeType.APPLICATION)
      public class DataCollectorManager
      {
           @Observer(CollectorConstants.ACCESS)
           public void collectAccess(EntityManager em)
           {
                ...
                
                em.merge(dateQuantity);
                em.flush();
           }     
      }



      Thanks in advance.