Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

difference between entity bean and session bean  RSS feed

 
sudarsan ym
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Session bean is having 2 type of bean
1. Stateless bean and stateful bean.
now i want to know the difference between entity bean and session bean.
Thanks in Advance
 
Michael Hildner
Ranch Hand
Posts: 297
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Thillai Sakthi
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!