1 Reply Latest reply on Aug 4, 2004 4:29 AM by invisiblemage

    is entity exists

    dannyb23

      Is there a better way to know whether an entity bean exists other than trying a finder and catching a FinderException ? (I dont like the idea of having an exception for an unexceptional state)

        • 1. Re: is entity exists
          invisiblemage

          Collection findAllByXXX(Integer xxx) throws FinderException;


          ....


          if (c.size() > 0) {
          entity exists...
          } else {
          ...not
          }

          Or in EJB 2.1 use COUNT in a ejbSelect if you will not need the entity after checking.