Environment:
The function:
@Transactional
public synchronized Long generateSequenseNumber(String requestType) {
//get current sequence number for this requestType
//increment it by one
//update it in DB
}
The function works fine, but the problem is when I call the application from stress testing tool (JMeter) to send 50 requests per second I get below exception:
org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [
although the function is synchronized.
Any suggestion will be helpful. Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…