0

I'm quite new to Java EE and I was asking myself the following question:

What are the differences between holding a link to a Stateful session bean and holding a link to a POJO in a SessionScoped Managed bean?

Since the ManagedBean is sessionscoped it's kept during the Session. Therefore I was thinking I could still have access to a simple POJO during the session. Right?

So what's the real purpose of a SFSB here?

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Matthieu Riegler
  • 31,918
  • 20
  • 95
  • 134

1 Answers1

1

The SFSB is an EJB and therefore has support for things like Container Managed Transactions, @Asynchronous method invocation and the @Schedule and @Timeout among other things.

The managed Bean has access to things like FacesContext and HttpContext etc..

So depending on your needs, the SFSB might not add anything you need. I for example have written a few hundred SLSB but not yet created my first SFSB, Because I let the User sessions live in the ManagedBeans and let the ejb-tier be user-session-unaware.

Look at: sessionscoped managed bean vs stateful ejb

Community
  • 1
  • 1
Aksel Willgert
  • 11,367
  • 5
  • 53
  • 74