Programming Restrictions
The specification lists the following programming restrictions, which you must follow when implementing the methods of an EJB class:
- The EJB is not allowed to start new threads or attempt to terminate the running thread.
- The EJB specification states that "an EJB is not allowed to use read/write static fields. Using read-only static fields is allowed. Therefore, all static fields must be declared as final." This is not a restriction for Oracle8i.
- The EJB is not allowed to use thread synchronization primitives.
- An EJB is not allowed to use the calls to an underlying transaction manager directly. The only exception are enterprise Beans with the TX_BEAN_MANAGED transaction attribute. These beans can use the
javax.jts.UserTransaction
interface to demarcate transactions.
- An EJB is not allowed to change its
java.security.Identity
. Any attempt to do so results in the java.security.SecurityException
being thrown.
- EJBs are not allowed to use JDBC commit and rollback methods, nor to issue direct SQL commit or rollback commands using SQLJ or JDBC.