Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Object State lost in Stateful Session Bean?

Thorsten Mueller
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I have a RequestScoped backing bean that has a reference to a stateful session bean which is responsible for holding state with the client like this:

public class MyController

ClientSession clientSession;

public void createClient(){


public class ClientSession

// a reference to the clientFacade to access the database
private ClientFacade clientFacade;

private int id;
private Client clientEntity;

public void createClientEntity(){
// create client object
clientEntity = new Client();
// save object in database



Now when I am invoking the "createClient()"-method in the JSF which is backed by MyController, the ClientSession succesfully creates a new clientEntity object and also persists it to the database. However, when I refresh the page, only the id (primitive integer) is maintained and the clientEntity object is null. Why does the Stateful bean forget the state of the object?

Best Regards,

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic