A session bean is an enterprise bean that handles the logic or business rules, for example a stock transaction. It's called a session bean because it lasts as long as the session. Maybe your session would be to log on, sell a stock and put that money in an account. This might be a stateful session bean, because it depenends on the state. The state is retained. A stateless session bean might be just one transaction - something where you don't need to know the state - like maybe just verifying a credit card number. An entity bean represents data - they don't do logic. So a session bean might use an entity bean to access data.
Session beans represents a business transaction. It may be like this: 1. Validate a credit card no. 2. Or simply to check your password while logging on. Here both the things say a process (or a "verb"). On the other hand entity beans are actually data. They are the lens to the data in the data base. They represents data. Examples could be 1. Employee no in a Emp Table could be represented by an entity bean. (Note they indicate "nouns"). Another difference lies in longevity of such beans. Session beans as they represents business process(typically one or more method calls),they are destroyed after their invocation. Extending the eg., the password validation is done when u r entering the site. That's it. As entity beans are a view to the data base they live as long as u wnat the data to stay in the data base. Hope this clarifies MK
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop