Re: Handling Unique Constraint Violations

From: Mike Kienenberger (mkienen..laska.net)
Date: Thu Jul 14 2005 - 12:20:53 EDT

  • Next message: Andrus Adamchik: "Re: Cayenne Commit Exception"

    Kevin Menard <kmenar..ervprise.com> wrote:
    > What's the Cayenne best practice for handling unique constraint
    > violations. I can see value in doing an explicit check before
    > inserting a new row, but I can also see the drawback there (two
    > places now need to know about this unique constraint). So, I'm
    > thinking that going ahead with the commit and catching the exception
    > might be cool, but it also seems to have some drawbacks.
    > How are you guys doing it?

    The one place I've done this before (user names), I check beforehand.
    In retrospect, I probably should have done this afterward as well.

    I think you pretty much have to check afterward to provide robust code.

    But doing it beforehand is a lot easier.

    Afterward, it's more difficult to know what caused the problem.

    So I have no answers, but I'm paying attention to what answers someone else
    comes up with :)

    -Mike



    This archive was generated by hypermail 2.0.0 : Thu Jul 14 2005 - 12:17:51 EDT