Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6180443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:50:43+00:00 2026-05-24T00:50:43+00:00

Say I have an Entity class, Car.  @Entity public class Car My IDE lets

  • 0

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 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T00:50:45+00:00Added an answer on May 24, 2026 at 12:50 am

    The JSF managed bean is the glue (controller) between the entity (model), the JSF page (view) and the enterprise bean (business service).

    So, yes, you are basically right in your understanding that the JSF page should invoke the managed bean’s action method which should in turn delegate the model and the action further to the business service and eventually handle the navigation outcome based on the result of the service call.

    But you are not entirely right in how the model should be used and passed around. Usually you make the model a property of the managed bean so that you can just bind it to the form’s input elements and finally pass it unchanged through to the business service.

    E.g.

    <h:inputText value="#{registrationController.car.make}" />
    <h:inputText value="#{registrationController.car.model}" />
    <h:inputText value="#{registrationController.car.year}" />
    <h:commandButton value="Save" action="#{registrationController.save}" />
    

    with

    private Car car;
    private @EJB CarFacade carFacade;
    
    public RegistrationController() {
        this.car = new Car();
    }
    
    public String save() {
        carFacade.create(car);
        return "someoutcome";
    }
    
    // ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have the typical entity Car class Car : Entity { public
Lets say i have this entity public class Address : Entity { public Address()
Let's say I have this entity (for Hibernate): @Entity public class Person { @Id
Hibernate allows you to just say .id. Let's say I have: @Entity public class
I have an entity, say @Entity public class Category { private String name; private
Let's say I have the following entity: public class Store { public List<Product> Products
Let's say I have an entity that looks like this: public class Album() {
Lets say we have User entity class. User can be friends with other users.
Say I have this class: @Entity @Table(name=PICTURE) public class Picture{ private String category1, category2;
Say I have a unidirectional @ManyToOne relationship like the following: @Entity public class Parent

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.