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

Read/Write Static fields in Enterprise Beans

 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got this excerpt from MK's SCBCD 5.0 notes,

"An enterprise bean must not use read/write static fields. Using read-only static fields is allowed. Therefore, it is recommended that all static fields in the enterprise bean class be declared as final."

But there is already a thread safety available with the EJB container. Then why do we need our static fields be declared static?
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

What type of thread safety is available in EJB for static field. Finally,EJB is java class and so many instances are created for one class. This is a basic requirement specified in the specification.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic