This is a question regarding code in the first example in Ivan Krizsan's OCP
Java EE 6
EJB Developer Study Notes on page 22. But first on page 13 of the study notes, and in the EJB 3.1 specification (chapter 21, section 2), it states that one EJB programming restriction is that an EJB must not use writable static fields. The motivation being to ensure consistency in a distributed environment.
Here is the code of a stateful session bean taken from the study notes on page 22:
If you look at line number 26, there is a static int declared as an instance variable. This static variable is updated in the @PostConstruct method. Doesn't this violate the restriction that an EJB must not use writeable static fields?
Thanks,
Ajay