1 Reply Latest reply on Oct 13, 2004 11:14 AM by Hideki Mae

    concurrency issue NoSuchEntityException

    Hideki Mae Newbie

      To all,
      I created a web application where I add a new data using CMT. The web page has a table where I can click on a link so I can edit the data. (I'm sure alot of people have done something similar).
      I have Servlet->Facade->CMP.
      My web page has a table with a link which contains the primary key to the data. In my facade I use findByPrimaryKey() so I can edit the data. However, I get the error:
      NoSuchEntityException:
      javax.ejb.NoSuchEntityException: Entity not found: primaryKey=14154
      Basically, I can not edit data that was recently added. Also, sometimes I am able to add/edit without a problem.
      I've looked up some web sites regarding the error but was unable to find a solution that was good.
      Has anyone else got this kind of problem? How did you fix it?

      Thanks in advance.

        • 1. Re: concurrency issue NoSuchEntityException
          Hideki Mae Newbie

          To all,
          I might have fixed the problem. However, I don't know why it worked. For my facade I put a xdoclet tag:
          "transaction-type=Container"
          This was something I found in a book "Enterprise JavaBeans" by Richard Monson-Haefel.
          Also, instead of using findByPrimaryKey() I created another finder method that will find data by the primary key. For example, the primary key was "geoUnitKey" and I created a finder method called findByGeoUnitKey(). I was just experimenting and it worked.
          Has anyone else experienced this kind of problem and did something similar? Can anyone tell me the technical reason why this works? I haven't figured it out yet.

          Thanks in advance for any information you can give me.