This question has been discussed by many people here. Please refer to the post: NX: DuplicateKeyException It includes 3-4 more links about this topic. In general, for my design, the system never throw DuplicateKeyException, as it is impossible to happen according to the user requirement, and the implemetation. I simply provide the exception class, document this fact. Nick.