Difference between a managed bean and a session bean

Viewed 13695

Say I have an Entity class, Car. 

@Entity
public class Car

My IDE lets me automatically generate session beans from entity classes, so I end up with a CarFacade

@Stateless
public class CarFacade

I can also generate JSF Managed beans

@ManagedBean     
@RequestScoped
public class RegistrationController

I can understand the meaningful difference between the Entity class and other beans, but what are the differences between a stateless session bean and a managed bean? I read that a stateless session bean is for implementing your business logic that operates on the entities and managed beans are for interacting with the web-based front-end, by having the webpage call methods on the managed bean, and having the managed bean call business methods on the session bean.

So in my example, the RegistrationController would feature a +register(String carRegistration) method that the webpage would call. The RegistrationController would in turn instantiate a Car and call +create(Car car) on the session bean, which would persist it.

Is this correct?

1 Answers
Related