11 Replies Latest reply on Sep 15, 2002 2:21 AM by Viyagula Jeffery

    Problem in retrieving getMethod

    Viyagula Jeffery Newbie


      I'm using CMP. When i say findByPrimaryKey i get a remote object. With that when i call remoteobject.getmethod is retrieves null value.
      Say for example username is my primary key field. when i call WBSUpdateHome wbsUpdateHome = (WBSUpdateHome) PortableRemoteObject.narrow (ref, WBSUpdateHome.class);
      wbsUpdateRemote = wbsUpdateHome.findByPrimaryKey("Jeffery");
      System.out.println("remote " +wbsUpdateRemote);
      System.out.println("getUserName "+wbsUpdateRemote.getUserName());
      System.out.println("getPassword "+wbsUpdateRemote.getPassword());

      getUserName retrieves "Jeffery" but
      getPassword retrieves null


      WBS Update Entity

      Bean class

      //Package Name
      package RecDel;

      //Import Declaration
      import java.rmi.RemoteException;
      import javax.ejb.*;

      This interface defines the `bean' interface for the `WBS' EJB.

      public class WBSUpdateBean implements EntityBean {

      public EntityContext ctx;
      public String username;
      public String password;

      public WBSUpdateBean(){
      System.out.println("Inside the constructor");

      //Remote Methods
      public String getPassword()
      System.out.println("getPassword called");
      return password;
      public String getUserName()
      System.out.println("getPassword called");
      return username;
      public void setPassword(String password){
      public void setUserName(String username){

      // Container managed CallBack Methods
      //ejbCreate for WBS
      public String ejbCreate (){
      System.out.println("EJBCreate method is called ...");
      return null;

      public void ejbPostCreate () {
      System.out.println("EJB POst Create is called....");

      public void ejbCreate (String username,String password) {
      System.out.println("EJBCreate method is called ..."+username);

      public void ejbPostCreate (String username,String password) {
      System.out.println("EJB POst Create is called...."+username);

      public void ejbActivate () throws RemoteException {
      System.out.println ("==============Invoking CheckingsBean::ejbActivate======");

      public void ejbLoad () throws RemoteException {
      System.out.println ("==============Invoking myEntityBean::ejbLoad==========");

      public void ejbPassivate () throws RemoteException {
      System.out.println ("==============Invoking myEntityBean::ejbPassivate=====");

      public void ejbRemove () throws RemoteException, RemoveException {
      System.out.println ("==============Invoking myEntityBean::ejbRemove========");

      public void ejbStore () throws RemoteException {
      System.out.println ("==============Invoking myEntityBean::ejbStore=========");

      public void setEntityContext (EntityContext context) throws RemoteException {
      System.out.println ("==============Invoking myEntityBean::setEntityContext=");
      this.ctx = context;

      public void unsetEntityContext() throws RemoteException {
      System.out.println ("==============Invoking myEntityBean::unsetEntityContext");
      this.ctx = null;

      private void jbInit() throws Exception {
      System.out.println ("==============Invoking myEntityBean::jbInit============");

      help me out
      Thank u