What is the major difference SessionBean and EntityBean?

Answers were Sorted based on User's Feedback



What is the major difference SessionBean and EntityBean?..

Answer / janet

Session Beans state can be shared by only one client at a
time - persistence storage device .ser file.
EntityBeans state can be shared by multiple
clients,because as its persistence storage device is DB.

Is This Answer Correct ?    5 Yes 2 No

What is the major difference SessionBean and EntityBean?..

Answer / sulthansheriff

In entity-bean , there are finder- method which are not in
session-bean
In entity-bean , CMR's are used , which are not there in
session-bean
----------------------------------------
Entity Beans
-------------
- represents an entity
- must have at least one finderXXX() method
- may or may not have create() or createXXX() methods
- when you call remove() on an entity bean the entity is
removed permanently but the bean instance goes back to the
pool it never die's.
- Entity beans home interface can have Home Business methods
- Entity beans home methods may or may not return component
interface object.
- Entity bean create() method creates a new row into the
database whereas create() method in session bean doesn't.
- Entity bean's finder method that returns a collection will
never throw a exception if it does not find related records
in the underlying persistent storage instead it will return
an empty collection.
- Entity beans will survive container crash as long as the
data is persisted in the underlying storage.
-----------------------------------------------------------
Session Bean
-------------
- generally they are used to perform some actions(verbs)
- there are two types of SB stateless and stateful.
- should have at least one create() "no args" constructor
(Stateless bean only)
- Stateless beans are more scalable then stateful beans.
- Stateless beans do not retain conversational state between
method invocations.
- Stateless beans are not tied to a particular client
whereas stateful beans are.
- The result of a client calling create() on home interface
of a stateless SB does not result into creation of a bean
but in stateful it does.
- There is no effect of calling remove() on Stateless
session bean because the beans go back to the pool after the
method call completes.
- session beans will never survive a container crash.

Is This Answer Correct ?    3 Yes 0 No

What is the major difference SessionBean and EntityBean?..

Answer / eavi

Session Beans state can be shared by only one client at a
time - persistence storage device .ser file.
EntityBeans state can be shared by multiple
clients,because as its persistence storage device is DB.

Is This Answer Correct ?    0 Yes 4 No

Post New Answer

More EJB Interview Questions

when deploying an EJB, does it possible to specify multiple JNDI names?

1 Answers   IBM,


Define Initial Context?

0 Answers  


How can a session bean be configured for transactions of bean-managed?

0 Answers  


Define ejb Create() and EjbPostCreate()?

0 Answers  


What is ejb and its properties?

0 Answers  






What is ejb and its types?

0 Answers  


Difference between javaBeans and Enterprise JavaBeans?

1 Answers   Indotech, Tech Mahindra,


What is the difference between ejb and spring?

0 Answers  


Why is ftp stateful?

0 Answers  


List some key actors in persistence api.

0 Answers  


What is @injectmock?

0 Answers  


can anyone explain me the workflow of EJB.I have developed an app. in WSAD using an example that contains CMP and session bean.But i am not able to understand the basic flow between diffrent packages.

0 Answers  


Categories