- for EJB Interface (including EJB Remote, Local, Remote Home, Local Home)
- An interface extending corresponding javax.ejb.XXX interface should be public/not final
- All methods should be implemented in an EJB class (except finders for an entity bean CMP)
- for EJB Remote-involved class (including EJB Remote Interface, Remote Home interface)
- All methods should throw java.rmi.RemoteException
- All methods arguments and return types should be RMI/IIOP compatible
- for EJB Local-involved class (including EJB Local Interface, Local Home interface)
- All methods should not throw java.rmi.RemoteException
- for EJB Home (including Remote Home, Local Home)
- A session bean and a message-driven bean should define a create method
- An entity bean should define findByPrimaryKey method which returns a component interface
- A create method should throw CreateException and return a component interface
- A stateless session bean should define create() only
- A finder method should throw FinderException and return a component interface or Collection
- for EJB Local interface
- A CMR field accessor signature should be consistent with ejb-jar.xml
- for EJB Class
- It should extend a corresponding javax.ejb.*Bean class
- It should be public, not final
- An entity bean CMP 2.0 should be abstract, all other should not
- It should define public no-args constructor
- A message-driven bean should implement javax.jms.MessageListener
- It should define, at least, one create method (except for entity bean)
- An entity bean should define a post-create method as well
- For each post-create method a corresponding create method should exist
- A create method should be public, not final, not abstract and defined in Home. Also it should throw
CreateException, return PK (for entity bean) or void if not
- A business method should have declaration in a component interface
- It should not define finalize()
- a CMP entity bean should define all CMP/CMR field accessors which should (not for CMP 1.x) be abstract
- CMP/CMR field getters/setters should be consistent (getter return type and setter argument type
should be the same)
- a CMR field accessor signature should be consistent with ejb-jar.xml
- ejbSelect should not be abstract and must throw FinderException
- Business, create, finder methods and method implementations from SessionBean/EntityBean/MessageDrivenBean
interfaces should not throw RemoteException (warning for EJB 1.x )
- Each Component interface should have a corresponding Home interface and vice versa
- There should be a Bean class
- Deployment descriptor should specify an ejb-name
- For an entity bean the following tags should be present: <persistent-type>,
<prim-key-class> (RMI/IIOP compatible), <reentrant>
- CMP/CMR fields should be valid Java identifiers beginning with a lower case letter
Checks below are performed inside an EJB class only (e.g. write to EJB static field from other class is not detected)
- There should be no writes to the EJB static fields
- EJB should not use java.awt.*, java.io.File*, java.lang.reflect.*, java.security.*,
java.net.ServerSocket, java.lang.ClassLoader, java.lang.SecurityManager, java.lang.Thread*
- EJB should not pass 'this' as method result or argument
|