Hi Parag,

This is very simple. Data is not returned by the entity bean. But you need to extract 
data from it.

this is as follows:

1. In your servlet get the reference to session bean

2. In the session bean get the refernce to the entity bean. (If your entity bean 
retrives a record then ... Just check your design once again. Entity bean should 
represet the record in the database.)

Suppose say, you are accessing a customer record.

3. In the session bean find the customer entity bean using findby methods.
   CustomerHome  custHome = (Customer) lookup("....");
    Customer cust = custHome.findById(1000);

4. Get the data from the entity bean using getMethods invoked on the entity bean
  Like,
    String str = cust.getName();
    int i = cust.getId();

    Keep them in a vector and it back to the Servlet.

Hope I am clear.

Regards,
Sripada

Parag Sankla wrote:

> Hi all.
> Does anybody have some code on the following scenario:
> (1)A servlet calling a stateless session bean passing some number/string as a 
>parameter.
> (2)The session bean in turn calling an entity bean passing the same number/string as 
>a parameter.
> (3)The entity bean talks to the database and retrieves the record corrosponding to 
>that number.Then it sends it back to the session bean.
> (4)Now the session bean sends this data back to the servlet.
> (5)The servlet now shows the data on the browser from which it was invoked .
>  The difficult part is how the entity bean will send the data to the session bean?In 
>the form of an object or what else ?
>  I will be very glad if you can help me in this.Even if you jnow some site where 
>such an example is available,that will be more than enough.I have seen a lot of 
>examples where the client directly talks to either a session bean or an entity 
>bean.But nowhere I found an example as I described above.
>  Thanking you in advance.Hoping for a positive reply.
>   Regards.
> Parag
>
> ===========================================================================
> 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