• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

MDB instance variable holding state

 
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?
 
Creator of Enthuware JWS+ V6
Posts: 3288
296
Android Eclipse IDE Chrome
  • 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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!