Best way to detect duplicates when using Spring Hibernate Template

Posted by Dean Povey on Stack Overflow See other posts from Stack Overflow or by Dean Povey
Published on 2010-05-07T07:32:22Z Indexed on 2010/05/07 7:38 UTC
Read the original article Hit count: 283

Filed under:
|
|

We have an application which needs to detect duplicates in certain fields on create. We are using Hibernate as our persistence layer and using Spring's HibernateTemplate. My question is whether it is better to do so an upfront lookup for the item before creating, or to attempt to catch the DataIntegrityViolation exception and then check if this is caused by a duplicate entry.

© Stack Overflow or respective owner

Related posts about java

Related posts about hibernate