Showing posts with label Stateless. Show all posts
Showing posts with label Stateless. Show all posts

Wednesday, 22 August 2012

Java Training: - Elaborate 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

Friday, 13 April 2012

Java interview questions: - Which other protocol is also called as stateless protocol?

A protocol is stateless if it can remember difference between one client request and the other. HTTP is a stateless protocol because each request is executed independently without any knowledge of the requests that came before it.


Figure: - HTTP Protocol in action

Above is a pictorial presentation of how a stateless protocol operates. User first sends “request1” and server responds with “response1”. When the same user comes back with “request2” server treats this as new user and has no idea that it’s the same user who has come with the request. In short every request is a new request for the HTTP protocol so it’s called as a stateless protocol.

See the following video on java for implementation of many To One relations in database using Hibernate: -



Click for more Java interview questions

Regards,

Visit for more author’s blog on Java interview questions