From the course: Java EE 7: Enterprise JavaBeans (EJB)

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Introduction to session beans

Introduction to session beans

From the course: Java EE 7: Enterprise JavaBeans (EJB)

Start my 1-month free trial

Introduction to session beans

- [Instructor] We briefly explore in our introduction what were session beans, but before we continue working with them let's add a bit more information on the subject. Like I've said before, session beans are used to execute particular tasks such as returning an inventory of vinyl records, but session beans comes in different flavors and this is what we'll explore over the course of this chapter. You have the stateful, stateless, and singleton session beans, and they each have their own use. The stateful bean maintains a state, so basically it keeps some data related to a client connected to it. The state of this client can be shared with another client. Once a client session is terminated, the data, or state is erased. A good example when to use this type is when you need to hold data in between different requests by a user. For example, how many times he's logged into the application. The stateless bean doesn't maintain a state and it's also used by many clients, versus the…

Contents