Thank you for your help, Tim. It worked.


Henry

Tim Squires wrote:

> What you need to do is create a primary key class with the primary keys in
> it:
>
> --------------------
>
> public class answerPK implements java.io.Serializable
> {
>
>   public Integer Id;
>   public Integer Answer_Type_Id;
>   /**
>    * Constructor
>    */
>   public answerPK( Integer Id, Integer Answer_Type_Id )
>   {
>     this.Id = Id;
>     this.Answer_Type_Id = Answer_Type_Id;
>   }
>
>   public answerPK() {}
>
>   public Integer getId() throws java.rmi.RemoteException
>   {
>     return Id;
>   }
>
>   public void setId( Integer Id ) throws java.rmi.RemoteException
>   {
>     this.Id = Id;
>   }
>
>   public Integer getAnswer_Type_Id()
>     throws java.rmi.RemoteException
>   {
>     return Answer_Type_Id;
>   }
>
>   public void setAnswer_Type_Id( Integer Answer_Type_Id )
>     throws java.rmi.RemoteException
>   {
>     this.Answer_Type_Id = Answer_Type_Id;
>   }
>
> }
>
> --------------------------------------------------------
>
> You can then specify in your descriptor:
> <prim-key-class>answerPK</prim-key-class>
>
> You still put the variables into your bean class and return the primary key
> class ( e.g. answerPK ) from the ejbCreate.
>
>   public answerPK ejbCreate( Integer Id, Integer Answer_Type_Id )
>     throws CreateException, RemoteException
>   {
>     this.Id = Id;
>     this.Answer_Type_Id = Answer_Type_Id;
>     return new answerPK( Id, Answer_Type_Id );
>   }
>
> Have fun,
> Tim.
>
> -----Original Message-----
> From: Henry Hu [mailto:[EMAIL PROTECTED]]
> Sent: 16 December 2000 02:21
> To: Orion-Interest
> Subject: compound key
>
> Could anybody tell me how I can specify a compound key in the descriptor
> file? When the primary key consists of  2 or more fields, the DTD told
> me not to specify the  "<primkey-field></primkey-field> "tag.  However,
> the deployment has an error as
>
>    No direct database fields for primary key
>
> Please help.
>
> Henry


Reply via email to