• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Surviving a Container Crash

 
Claire Simpson
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

I am very confused as to how to answer the question which types of EJB can survive a Container Crash. There are contradictions in opinions even within this forum. Does anyone know what answer will be seen as correct on the exam?

So far Entity Bean seems like a certainty to survuve and Stateful Session Bean not to survive. But I've seen conflicting opinions on whether Stateless Session Beans or MDBs survive. Help!
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Claire

Entity Beans: survive container crash because an entity bean is saved as a record in the database.

Stateless/Stateful Session Beans / Message-driven Beans: do not survive container crash.

Thanks

-- Ravi
 
Claire Simpson
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for clearing that one up Ravi.
 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps by understanding/knowing why does entity beans survive container crashes, you would find no confusion anywhere.

Entity beans represent an entity in the underlying store (usually a database). In the simplest example, an entity bean could be representing a single row in a table in our database.

So what if our web/application server crashes? When we get it up again, the entity bean could simple fetch the data from the database again, because, the crash of the web/application server is not tied to the database. Unless, of course, our database crashes, then the entity bean cannot get back its value (but you could backup & restore your database).

Think about session beans & MDBs. Do you store any of the state that they carry in any form of persistent storage? Nope. They're all in the heap. Memory.

HTH.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic