Guys,
I am having problem with creating an entity bean with PK class. Please somebody let me know what is wrong in the code.
Remote Class
---------------------------------
public interface PKEntity extends EJBObject{
public
String getName() throws RemoteException;
public int getId() throws RemoteException;
}
---------------------------------
PK Class
---------------------------------
public class PKEntityBeanPK implements Serializable{
public String name = null;
public String getName() {
return this.name;
}
public void setName(String s) {
this.name = s;
}
public PKEntityBeanPK(String s){
this.name = s;
}
public PKEntityBeanPK(){
}
public int hashCode(){
return this.hashCode();
}
public boolean equals(Object pk){
PKEntityBeanPK other = (PKEntityBeanPK) pk;
if(other.name == this.name ){
return true;
}
return false;
}
}
---------------------------------
Bean Class
--------------------------------
public abstract class PKEntityBean implements EntityBean{
EntityContext context = null;
public abstract void setName(String s) ;
public abstract String getName() ;
public abstract void setId(int s) ;
public abstract int getId() ;
public void ejbActivate(){
}
public void ejbPassivate(){
}
public void ejbRemove(){
}
public void setEntityContext(EntityContext conx){
context=conx;
}
public void unsetEntityContext(){
}
public void ejbLoad(){
}
public void ejbStore(){
}
public PKEntityBeanPK ejbCreate(String name, int id) throws CreateException{
this.setName(name);
this.setId(id);
System.out.println("I am Here");
return null;
}
public void ejbPostCreate(String name, int id) throws CreateException {
}
}
--------------------------------
Home Class
---------------------------------
public interface PKEntityHome extends EJBHome{
public PKEntity create(String name, int id) throws CreateException, RemoteException;
public PKEntity findByPrimaryKey(PKEntityBeanPK pk) throws FinderException, RemoteException;
}
---------------------------------
It was deployed properly. When i execute the create method, i am getting runtime exception and i am also getting output "I am Here" which is ejbCreate method.
Please somebody help me.
Thanks,
Prashant