I can't say what's going wrong, but why do you use a PK class? If you're PK
is of type String you can use the String class directly.

> -----Original Message-----
> From: Pranjal [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 01, 1999 1:47 AM
> To: [EMAIL PROTECTED]
> Subject: Primary Key String
>
>
> I am building an entity bean with string parameter as primary key
> In primary key class i have String as attribute and also
> methods equals()
> and hascode()
>
> but when i try accessing from client.. error comes as :
> ********************************************************
> ObjectNotFoundException: primary key not found , with primary key xyz
> **********************************************************
> but the entry of that recoed is there in the table..?
>
> In table the primary key is of type char.
>
> can anybody suggest some thing..
> here is the client code
> *********************************
> UserInfoEntityHome userSesHome = (UserInfoEntityHome)
> ic.lookup("UserInfoEntity.user");
>    System.out.println("home found************");
>    com.powershare.userinfo.UserInfoPK pk = new
> com.powershare.userinfo.UserInfoPK();
>    pk.userID = "xyz";
>
>    UserInfoEntityRemote userDet = userSesHome.findByPrimaryKey(pk);
>
> ***********************************
>
> here is the primary key code
>
> ***************************************************************
>
> public class UserInfoPK implements java.io.Serializable
> {
>     public String userID = null;
>
>  public UserInfoPK() {}
>
>  public UserInfoPK(String uid)
>  {
>   userID = new String(uid);
>  }
>
>
>
>  public int  hashCode()
>  {
>         return userID.hashCode();
>
>     }
>
>  public String toString()
>  {
>        return userID.toString();
>     }
>
>  public boolean equals(Object obj)
>  {
>         if(obj instanceof UserInfoPK)
>   {
>             UserInfoPK pk = (UserInfoPK) obj;
>    return userID.equals(pk.userID);
>         }
>   else
>   {
>    return false;
>   }
>     }
>
> } // close UserInfoPK
>
> ==============================================================
> =============
> To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the body
> of the message "signoff EJB-INTEREST".  For general help,
> send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to