2 Replies Latest reply on May 16, 2004 12:23 PM by gorano

    Entity insert/update

    gorano Newbie

      Hi guys,

      The scenario is:
      If an cmp entity exists I want to update it, if not I want to create it.

      My solution of this is to use findByPrimaryKey. If found I update.
      If not found a FinderException is thrown and I create the entity in
      the catch.

      But we are all told not to use exceptions as a part of our non-exceptional
      logic.

      Is there another simple way of avoiding the use of the FinderException?

      I kind of miss a method called exist or something.

      Thanks,

      Goran