Say you have a bunch of Article objects, with a "title" property. Then there's an ARTICLE table with a TITLE column. The TITLE column has a unique constraint.
The UI shows all the articles on one page, with a text field for editing the title.
Imagine a situation where you have two articles X & Y, X having the title "1" and Y having the title "2". In the page, you rename Y to "2" and X to "1", then submit the form. With the values from the form copied directly to the hibernate objects and saved, a ConstraintViolationException will occur.
It also happens if you remove a "1" article from a collection, then add another article with the title "1" and save the collection.
So what is the best way to deal with this Hibernate quirk? I get the feeling I should rearrange the UI or something. Manually checking for these conditions before saving the hibernate objects seems a bit cumbersome.