• Post Reply Bookmark Topic Watch Topic
  • New Topic

MDB instance variable holding state  RSS feed

 
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
Posts: 3015
236
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!