0 Replies Latest reply on Sep 18, 2007 5:31 PM by Toni Beckman

    Duplicate Key Violation

    Toni Beckman Novice

      Hi,

      In my application it's very likely that two or more entity beans with the same primary key (a string) get persisted at the same time. If that happens a "duplicate key" exception is raised and the the current transaction is being rolled back.

      The problem is that it does not seem to be possible to recover from this error. Trying to catch the exception still leaves the transaction invalid. How can I make sure that I catch this kind of duplicate key exception without the current transaction being rolled back, when I call entityManager.persit(myEntityBean) ???

      Toni