hi rajan,

check out ur xml-descriptor file...when u have have cmp there is no need of
findByPrimaryKey method in bean but in case u have BMP it is
required...check out if ur three xml-descriptor files are similar to the
descriptor giben in examples of enity bean provided with weblogic(hope u r
using Weblogic).


Piyush


> -----Original Message-----
> From: Rajan Kashyap [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, September 20, 2000 5:58 AM
> To:   [EMAIL PROTECTED]
> Subject:      CMP giving PK error while generating container.
>
> Hi Friends,
>         This might be vendor specific question but I am posting it to the
> list
> because I am not able to figure out whether the problem is only with
> weblogic or some other app server also.
>         EJB guru's can just have look at the code and can comment on
> this...
>
>         My problem is that when I am trying to generate container for CMP
> it is
> giving following error
>         "In EJB Product, the home interface must define the
> findByPrimaryKey
> method."
>
> But findByPrimaryKey is there in home interface , it is taking primary key
> class as argument and returning remote interface and is public.
>
> If I make the same as BMP it is saying that
>
> "In EJB Product, the find method
> findByPrimaryKey(ejb.entity.cmp.product.ProductPK) did not have a
> corresponding ejbFind method in the bean class."
>
> Here is my source .....
>
> -----------------------------------------------------------------
> package ejb.entity.cmp.product;
>
> import javax.ejb.*;
> import java.rmi.RemoteException;
> import java.util.Enumeration;
>
> public interface ProductHome extends EJBHome {
>     public Product create(String productID, String name, String
> description,
> double basePrice) throws CreateException, RemoteException;
>     public Product findByPrimaryKey(ProductPK key) throws FinderException,
> RemoteException;
>     //public Enumeration findByName(String name) throws FinderException,
> RemoteException;
>    // public Enumeration findByDescription(String description) throws
> FinderException, RemoteException;
>   //  public Enumeration findByBasePrice(double basePrice) throws
> FinderException, RemoteException;
>   //  public Enumeration findExpensiveProducts(double minPrice) throws
> FinderException, RemoteException;
>    // public Enumeration findCheapProducts(double maxPrice) throws
> FinderException, RemoteException;
>   //  public Enumeration findAllProducts() throws FinderException,
> RemoteException;
> }
> _-------------------------------------------------------------------------
> --
> ---
>
> package ejb.entity.cmp.product;
>
> import java.sql.*;
> import javax.naming.*;
> import javax.ejb.*;
> import java.util.*;
> import java.rmi.RemoteException;
> public class ProductBean implements EntityBean {
>     protected EntityContext ctx;
>
>     public String productID; // PK
>     public String name;
>     public String description;
>     public double basePrice;
>
>     public ProductBean() {
>         System.out.println("New Product Entity Bean Java Object created by
> EJB Container.");
>     }
>
>
>     public String getName() throws RemoteException {
>         System.out.println("getName() called.");
>         return name;
>     }
>
>
>     public void setName(String name) throws RemoteException {
>         System.out.println("getName() called.");
>         this.name = name;
>     }
>
>     public String getDescription() throws RemoteException {
>         System.out.println("getDescription() called.");
>         return description;
>     }
>
>
>     public void setDescription(String description) throws RemoteException
> {
>         System.out.println("setDescription() called.");
>         this.description = description;
>     }
>
>     public double getBasePrice() throws RemoteException {
>         System.out.println("getBasePrice() called.");
>         return basePrice;
>     }
>
>     public void setBasePrice(double price) throws RemoteException {
>         System.out.println("setBasePrice() called.");
>         this.basePrice = price;
>     }
>
>     public String getProductID() {
>         System.out.println("getProductID() called.");
>         return productID;
>     }
>
>
>
>     public void ejbActivate() throws RemoteException {
>         System.out.println("ejbActivate() called.");
>     }
>
>
>
>     public void ejbRemove() throws RemoteException {
>         System.out.println("ejbRemove() called.");
>     }
>
>
>
>     public void ejbPassivate() throws RemoteException {
>         System.out.println("ejbPassivate () called.");
>     }
>
>     public void ejbLoad() throws RemoteException {
>         System.out.println("ejbLoad() called.");
>     }
>
>
>     public void ejbStore() throws RemoteException {
>         System.out.println("ejbStore() called.");
>     }
>
>
>     public void setEntityContext(EntityContext ctx) throws RemoteException
> {
>         System.out.println("setEntityContext called");
>         this.ctx = ctx;
>     }
>
>
>
>     public void unsetEntityContext() throws RemoteException {
>         System.out.println("unsetEntityContext called");
>         this.ctx = null;
>     }
>
>
>
>     public void ejbPostCreate(String productID, String name, String
>         description, double basePrice) throws RemoteException {
>         System.out.println("ejbPostCreate() called");
>     }
>
>
>
>     public void ejbCreate(String productID, String name, String
> description,
> double basePrice) throws
>     CreateException, RemoteException {
>         System.out.println("ejbCreate(" + productID + ", " + name + ", "
> +description + ", " + basePrice + ") called");
>         this.productID = productID;
>         this.name = name;
>         this.description = description;
>         this.basePrice = basePrice;
>     }
>
> }
> --------------------------------------------------------------------------
> --
> -------------
>
> package ejb.entity.cmp.product;
> import javax.ejb.*;
> import java.rmi.RemoteException;
>
> public interface Product extends EJBObject {
>
>     public String getName() throws RemoteException;
>     public void setName(String name) throws RemoteException;
>     public String getDescription() throws RemoteException;
>     public void setDescription(String description) throws RemoteException;
>     public double getBasePrice() throws RemoteException;
>     public void setBasePrice(double price) throws RemoteException;
>     public String getProductID() throws RemoteException;
> }
> ------------------------------------------
> package ejb.entity.cmp.product;
>
> import java.io.Serializable;
>
> public class ProductPK implements java.io.Serializable {
>
>     public String productID;
>     public ProductPK(String productID) {
>         this.productID = productID;
>     }
>
>     public ProductPK() {
>     }
>
>     public String toString() {
>         return productID.toString();
>     }
>     public int HashCode(){
>       return productID.hashCode();
>     }
>
>     public boolean equals(Object obj){
>       if (obj instanceof ProductPK)
>         return ((ProductPK)obj).toString().equals(productID);
>       return false;
>     }
> }
> -----------------------------
>
>
> Thanks,
> Rajan
>
> ==========================================================================
> =
> 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".
This e-mail and any files transmitted with it are for the sole use
of the intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply e-mail and
destroy all copies of the original message. Any unauthorised review, use, disclosure,
dissemination, forwarding, printing or copying of this email or any action taken in
reliance on this e-mail is strictly prohibited and may be unlawful.

                Visit us at http://www.cognizant.com

===========================================================================
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