Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MDB instance variable holding state

 
Nandhini Sridharan
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In chapter 3 on Frits EJB 3.1 notes, its been stated that

A Message Driven bean instance variables can contain state across the handling of messages (e.g. database connection or reference to an enterprise bean).

Q1. Can MDB contain reference to stateful session bean?
Q2. With the statement, instance variables can contain state across the handling of messages Are the stateful session bean state is carried over or as per the DI rule when the MDB instance is destroyed, the DI automatically removes the stateful session bean?
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2534
113
Android Chrome Eclipse IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q1. Can MDB contain reference to stateful session bean?

Yes, however I can't think of a practical use case, as the Stateful Session Bean is always connected to one particuliar client whereas the Message Driven Bean doesn't have a client.

Q2. With the statement, instance variables can contain state across the handling of messages Are the stateful session bean state is carried over or as per the DI rule when the MDB instance is destroyed, the DI automatically removes the stateful session bean?

No, only the MDB.
 
Nandhini Sridharan
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Frits
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic