+

Search Tips   |   Advanced Search

EJB metadata annotations

Annotations allow us to write metadata for EJB inside your source code. Use them instead of extensible markup language (XML) deployment descriptor files. Annotations can also be used with descriptor files.

If we installed the Feature Pack for EJB 3.0, the default was to scan annotations during the installation of an EJB 3.0 module. For WebSphere Application Server, Version 7.0 and later, the default is not to scan pre-Java EE 5 modules during the application installation or at server startup

To preserve backward compatibility with both the Feature Pack for EJB 3.0 and the Feature Pack for Web Services, we have a choice whether to scan legacy web modules for additional metadata. A server level switch is defined for each feature pack scan behavior. If the default is not appropriate, the switch must be set on each server and administrative server that requires a change in the default. The switches are server custom properties com.ibm.websphere.webservices.UseWSFEP61ScanPolicy={true|false} and com.ibm.websphere.ejb.UseEJB61FEPScanPolicy={true|false}. To define these properties in the administrative console click Application servers > server name > Process definition > Java Virtual Machine > Custom properties.

The product also provides default values for most of the EJB annotations it uses. In many cases, omitting an annotation implies to use the default value.

Usually, annotations are found in the javax.ejb and javax.persistence packages.

Annotation type
AccessTimeout
ExcludeDefaultInterceptors
AfterBegin
AfterCompletion
ApplicationException
AroundInvoke
Asynchronous
BeforeCompletion
ConcurrencyManagement
DependsOn
EJB
EJBs
ExcludeDefaultInterceptors
ExcludeDefaultInterceptors
Init
Interceptors
Local
Lock
LocalBean
LocalHome
MessageDriven
PersistenceUnit
PostActivate
PostConstruct
PreDestroy
PrePassivate
Remote
RemoteHome
Remove
Resource
Schedule
Schedules
Singleton
Startup
StatefulTimeout
Stateless
Timeout
TransactionAttribute
TransactionManagement
TransactionManagement


Related:

  • Enterprise beans
  • Application exceptions
  • Developing enterprise beans
  • EJB 3.x interceptors
  • Enterprise bean development best practices