Two Laptop Bag
The moose likes EJB and other Java EE Technologies and the fly likes Global variables in SessionBeans? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Global variables in SessionBeans?" Watch "Global variables in SessionBeans?" New topic

Global variables in SessionBeans?

Murali Mohan
Ranch Hand

Joined: Jul 07, 2003
Posts: 47
Can we declare global variables in stateless and stateful session beans? How does container handles it?
Kyle Brown
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
The answer to this question is no. Non-final static variables are not allowed in any EJB.
The questions you are asking are very basic -- I understand that you are just starting out with EJB's, and that's great -- but all of the answers to these questions can be found in any of the basic texts on EJB's. I suggest you either read Ed Roman's "Mastering EJB" (which is available online at the ServerSide) or you buy a copy of Richard Monson-Haefel's "Enterprise JavaBeans".

Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at for other WebSphere information.
I agree. Here's the link:
subject: Global variables in SessionBeans?
It's not a secret anymore!