1 Reply Latest reply on Nov 8, 2002 9:24 PM by meb1

    create NullPointerException

    meb1

      JBoss 3.0.3 using CMP is throwing a NullPointerException when I create an entity bean from my session bean and try to use the entity bean reference.

      -----------Session bean code------------

      TaskHome uhome = (TaskHome) getHome("Task");
      Task task = uhome.create( getMemberId() );

      System.out.println( task.getTaskId() ); // <== Blows here

      -----------Session bean code------------


      -----------Task Home code------------

      Task create(Integer memberId) throws CreateException;

      -----------Task Home code------------

      -----------Task IF------------

      public interface Task extends EJBLocalObject
      {
      public Integer getTaskId();

      public String getDescription();
      public void setDescription(String desc);

      public String getClientId();
      public void setClientId(String desc);
      }
      -----------Task IF------------


      -----------Task Bean code------------

      public Integer ejbCreate(Integer memberId)
      throws CreateException
      {
      setMemberId(memberId);
      return null;
      }

      -----------Task Bean code------------


      I'm not using CMR anywhere, does anyone have any thoughts as to why this is happening?

      meb

        • 1. Re: create NullPointerException
          meb1

          Well I found out why the EJBObject returned from the create is invalid; the database table in the legacy system creates the primary key via an autoincrement placed on the column. Apparently this is too much for good old EJB to handle and I cannot find a way in a CMP to create the record and the return the primary key the db created enable the EJBObject returned to be valid and hence usable.

          Anybody have any ideas on that?