Problem in retrieving getMethod
pvjeffery Sep 14, 2002 1:12 AMhi
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
ejb-jar.xml
WBS Update Entity
<ejb-name>WBSUPDATE</ejb-name>
RecDel.WBSUpdateHome
RecDel.WBSUpdate
<ejb-class>RecDel.WBSUpdateBean</ejb-class>
<persistence-type>Container</persistence-type>
False
<prim-key-class>java.lang.String</prim-key-class>
<primkey-field>username</primkey-field>
<cmp-field>
<field-name>username</field-name>
</cmp-field>
<cmp-field>
<field-name>password</field-name>
</cmp-field>
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){
this.password=password;
}
public void setUserName(String username){
this.username=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) {
this.username=username;
this.password=password;
System.out.println("EJBCreate method is called ..."+username);
}
public void ejbPostCreate (String username,String password) {
this.username=username;
this.password=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
Jeffery