Pregunta

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?

¿Fue útil?

Solución

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top