4 Replies Latest reply on Jul 24, 2002 8:44 PM by Andres Gonzalez

    javax.ejb.ObjectNotFoundException with CMP. No such entity!!

    Andres Gonzalez Newbie

      Hello guys... I keep getting an error like this:
      .
      .
      .
      2002-07-24 15:02:49,375 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.user.findByPrimaryKey] Executing SQL: SELECT userName FROM user WHERE userName=?
      2002-07-24 15:02:49,921 ERROR [STDERR] javax.ejb.ObjectNotFoundException: No such entity!
      2002-07-24 15:02:49,937 ERROR [STDERR] at org.jboss.ejb.plugins.cmp.jdbc.JDBCFindEntityCommand.execute(JDBCFindEntityCommand.java:46)
      2002-07-24 15:02:49,937 ERROR [STDERR] at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.findEntity(JDBCStoreManager.java:541)
      .
      .
      .

      I'm doing something like this:
      LocalUser myLocalUser = home.findByPrimaryKey(query);
      if (myLocalUser != null)
      {
      log("user Exists!!");
      }
      else
      {
      myLocalUser = home.create(f.getUserName(), f.getPassword1(),f.getEmail(), address,f.getMobile());
      }

      the app works ok if the user exists.. it prompts the message. but when I try to create a new user I get this annoying error.

      it is funny because when I was testing inserting data in the database it is working ok. I mean, only doing this:

      myLocalUser = home.create(f.getUserName(), f.getPassword1(),f.getEmail(), address,f.getMobile());

      but when I added this 'validation' stuff everything screwed up..

      any ideas?