update complex logic for hibernate and spring transaction