2 Replies Latest reply on Mar 20, 2008 7:59 AM by mars1412

    newbie: em.flush() is locking a select statement

      I just noticed following issue, that I can't understand.

      I change some properties on myEntity and set a breakpoint before

      entityManager.flush();


      In a command window I start sqlcmd (MS-Sql Servers commandline interface) and select the entity that I am about to change.

      select * from MyEntity where id = 1;


      This works as expected.

      Then in the debugger I execute the flush() statement (only this single line).

      When I now try to do the same select in my command window, the select blocks until I resume my debugging session!
      As soon as the debugged transaction is committed, the select in the command window resumes and gives me the results.

      What is going on here??

      How can the update-statement in my debugging session block a select (!) statement in another transaction (that even exists in another process)?

      If I issued another update in the command window this behaviour would be ok. But not for a select, where I only read the data.

      I hope someone can enlighten me.