Often been asked about deadlock questions from database. However, I have never met them. Today, I found finally the dead lock problem while insert data into one table at the same time. At last, through researching online, it is so easy to solve this problem, just add flush() method after each save method to commit transaction. For example,
// Updates group status.
TRequest request = requestDao.findById(vo.getgId());
Another method is for hibernate by configure hibernate in configuration file as following: