When should we use session bean/entity bean?I was unable to judge?For Example :For Airline Project where we can use EJB\'s?How can we differentiate the stateful and stateless session beans?

Showing Answers 1 - 4 of 4 Answers

Karthikeyan

  • Dec 22nd, 2005
 

Hi ,

  Follow the simple rule.

1. Use session bean to do some actions like bookTicket, cancelTicket, checkForAvailablity etc.

2. Whenever your going to represent something from database use entity bean. Like Customar, Airplan , Seat etc.

With SMile

VK

  Was this answer useful?  Yes

Session beans are used to execute business logici.e in airline reservation entity beans are connected to database to get the data and give it to the session beans to update like suppose to reserve one seat::::::::entitybeans load the current reserved seats and give it to the session beans session beans update the current reserved seat and give it to the entity beans then entity beans save the updated data into the entity beanssuppose:entity bans load data like::::::::load(){seat 1,2,3,4,5,6.......... , 10 are reserved(entity beans load this data and send it to the}session beanssession beans do like:::::::::reserve(){reserve=seat10+1}in entity beans:::::::store(){ updateseat(reserve);}this reserve varible has give to the entity beans to save it into the database.

  Was this answer useful?  Yes

antony

  • Jan 14th, 2006
 

Thanks vemodher.... Good answer

  Was this answer useful?  Yes

s_s78

  • Mar 20th, 2006
 

Session bean has business logic and database operation methods.

Entity bean's one feature is to make your application database independent. means if you change database,tables u need not to see code written in your session bean u just need to edit very few line in you entity DD files.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions