Hi!

> Damon Williams wrote:
> Can you define static variables in an EJB?

No, and the reason is class loading as Imre said. But it's more than
just different class loaders loading different classes. Let's say your
EJB server supports runtime reloading of your beans (I think this is
called "hot update"). This can be done by checking the jar timestamps,
or at a given interval, or as a user initiated action. Each time the
server updates the bean classes all statics will be reset to their
initial values, and that's the most important reason why statics in
beans is a bad idea: you cannot rely on them to not be reset at any
time. It simply wont work, and since it is an inherent feature of EJB it
wont change either.

Use objects bound in JNDI instead.

HTH

/Rickard

--
Rickard �berg

Computer Science student@LiTH
@home: +46 13 177937
Email: [EMAIL PROTECTED]
Homepage: http://www-und.ida.liu.se/~ricob684

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to