This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Why can't we use 'static' in EJB? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Why can Watch "Why can New topic
Author

Why can't we use 'static' in EJB?

rui lin
Greenhorn

Joined: May 19, 2003
Posts: 5
Would you please tell me why?
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
You can use static variables -- as long as their read-only (final). The reason for not being allowed to use read-write static variables is that the EJB container would have hard time synchronizing the static variable across the cluster.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
rui lin
Greenhorn

Joined: May 19, 2003
Posts: 5
Thanks to Lasse.
 
wood burning stoves
 
subject: Why can't we use 'static' in EJB?