[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - newbie: em.flush() is locking a select statement

mars1412 do-not-reply at jboss.com
Thu Mar 20 05:23:38 EDT 2008

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

I change some properties on myEntity and set a breakpoint before


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.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4137978#4137978

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4137978

More information about the jboss-user mailing list