Java Training: – How will you explain stateful and stateless session bean?

Stateful Session bean:-

  • Stateful session bean maintain the state of the conversation between the client and itself
  • When the client invokes a method on the bean the instance variables of the bean may contain a state but only for the duration of the invocation
  • implements the javax.ejb.SessionBean interface and is deployed with the declarative attribute “stateful”

Stateless session bean:-

  • A stateless session bean is an enterprise bean that provides a stateless service to the client.
  • Conceptually, the business methods on a stateless session bean are similar to procedural applications or static methods; there is no instance state, so all the data needed to execute the method is provided by the method arguments
  • implements the javax.ejb.SessionBean interface and is deployed with the declarative attribute “stateless

See the following video on Factory Pattern in Hibernate: –


Click to get Java Training

Regards,

Get more Java Training from author’s blog

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s