What is the difference between stateful session bean and entity bean

Hi,Can u pl. tell me the main difference between stateful session bean and entity bean, other than persistance or database related.How to choose among Stateful Session bean, BMPand CMP. What are basic critiria to choose any of them.
[267 byte] By [amarjavasea] at [2007-11-26 18:32:27]
# 1
http://forum.java.sun.com/thread.jspa?threadID=793082&messageID=4508008#4508008Entity EJB (BMP type and CMP type) should model business entities. Session EJB (stateful and stateless) should model business workflow.
GhostRadioTwoa at 2007-7-9 6:06:32 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

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.

There are many more things we can talk about both bean types.

javaProa at 2007-7-9 6:06:33 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...