A test with Hibernate and MySQL to come up with some strategy to solve the first-insert/then-update duplicate-key dilemma