7 Replies Latest reply on Sep 17, 2005 8:39 PM by Bill Burke

    EntityManager find for primary key lookup not throwing Entit

    Andrig Miller Newbie

      In an EJB3 application that I am writing, I tried using the EntityManager's built in find method, to find a bean by its' primary key. When the bean isn't there, I want to insert a new one, and if it is there I want to update it. The problem is that the find method never throws the EntityNotFound exception, so I cannot do the insert if its not there. If I use a createQuery method, and specify the query, I get the EntityNotFound exception thrown appropriately, and my logic works perfectly.

      Looking at the interface definition from Sun, it appears that the find method should throw the EntityNotFound exception from the find method. I think this is a bug, but I didn't want to add it to JIRA until someone could confirm this.

      Thanks.