2 Replies Latest reply on Apr 16, 2007 3:32 PM by fhh

    EntityNotFoundException when performing EntityManager.refres

    Wayne Bagguley Newbie

      Here is my scenario. I have an entity bean 'Request' that has a list of entity beans 'Detail'. I use the @OneToMany(cascade=ALL) annotation for the relationship.

      I have a page where I can edit 'Request' and add 'Detail' objects to it. If I click 'save' then everything is saved perfectly. If I hit 'discard' then I try and call:

      so that the details are reverted back to the database. If I don't add any 'Detail' objects, it works, but if I do add them and then click 'discard' I get this exception:
      javax.persistence.EntityNotFoundException: No row with the given identifier exists

      I am using

      on the initial method and

      on the discard method.

      I guess that this is because the newly created Detail objects don't exist in the database, but I thought that calling the refresh method would take this possibility into account?