• 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
Posts: 2791
181
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
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!