Hi,

I'm just wondering if the following code could be subject to a race
condition when accessed by many threads

em.getTransaction().begin();
bean.setCount(bean.getCount() + 1);
em.getTransaction().commit();

My understanding is that it would be possible here for two threads to set
the same value for the new count (given that each thread has a different
em). Is that correct?

Do I have to use an UPDATE query to make this function as expected?

Thanks,

Roger
-- 
View this message in context: 
http://www.nabble.com/race-condition-in-a-transaction--tf2922964.html#a8170503
Sent from the open-jpa-dev mailing list archive at Nabble.com.

Reply via email to