A EJB Metadata Annotations Reference

This appendix provides reference information for the EJB metadata annotations.

Overview of EJB Annotations

The WebLogic Server EJB programming model uses the Jakarta EE metadata annotations feature in which you create an annotated EJB bean file, and then compile the class with standard Java compiler, which can then be packaged into a target module for deployment. At runtime, WebLogic Server parses the annotations and applies the required behavioral aspects to the bean file.

For detailed reference information regarding which metadata annotations you can specify in the EJB bean file, see the package summaries in Jakarta EE Platform API.

Some of the annotations are in the jakarta.ejb package, and are thus specific to EJBs; others are more common and are used by other Jakarta EE components, and are thus in more generic packages, such as jakarta.annotation. See:

Note:

If you are continuing to use deployment descriptors in your EJB implementation, refer to EJB Deployment Descriptors in Developing Jakarta Enterprise Beans Using Deployment Descriptors.

WebLogic Annotations

This section provides reference information for WebLogic annotations.

weblogic.javaee.AllowRemoveDuringTransaction

The following sections describe the annotation in more detail.

Description

Target: Class (Stateful session EJBs only)

Flag that specifies whether an instance can be removed during a transaction.

Note:

This annotation is overridden by the allow-remove-during-transaction element in the weblogic-ejb-jar.xml deployment descriptor. See weblogic-ejb-jar.xml Deployment Descriptor Reference in Developing Jakarta Enterprise Beans Using Deployment Descriptors.

weblogic.javaee.CallByReference

The following sections describe the annotation in more detail.

Description

Target: Class (stateful, stateless, or singleton session beans only)

Enables call-by-reference semantics for eligible invocations within the same application. It does not change remote invocation semantics; arguments that cross a remote boundary are passed by value.

Note:

This annotation is overridden by the enable-call-by-reference element in the weblogic-ejb-jar.xml deployment descriptor. See weblogic-ejb-jar.xml Deployment Descriptor Reference in Developing Jakarta Enterprise Beans Using Deployment Descriptors.

weblogic.javaee.DisableWarnings

The following sections describe the annotation in more detail.

Description

Target: Class

Specifies that WebLogic Server should disable the warning message whose ID is specified.

Note:

This annotation is overridden by the disable-warning element in the weblogic-ejb-jar.xml deployment descriptor. See weblogic-ejb-jar.xml Deployment Descriptor Reference in Developing Jakarta Enterprise Beans Using Deployment Descriptors.

Attributes

The following table summarizes the attributes.

Table A-1 Attributes of the weblogic.javaee.DisableWarnings

Name Description Data Type Required?
value Warning codes to disable: WarningCode.BEA_010001, WarningCode.BEA_010054, WarningCode.BEA_010200, and/or WarningCode.BEA_010202 WarningCode[] Yes

weblogic.javaee.EJBReference

The following sections describe the annotation in more detail.

Description

Target: Class, Method, Field

Maps EJB reference name to its JNDI name.

Attribute

The following table summarizes the attributes.

Table A-2 Attribute of the weblogic.javaee.EJBReference Annotation

Name Description Data Type Required?

name

Specifies the name by which the referenced EJB is to be looked up in the environment.

This name must be unique within the deployment unit, which consists of the class and its superclass.

String

No

Defaults to an empty string.

jndiName

Specifies the JNDI name of an actual EJB, resource, or reference available in WebLogic Server.

String

Yes

weblogic.javaee.Idempotent

The following sections describe the annotation in more detail.

Description

Target: Method (session-bean or message-driven-bean implementation methods)

Specifies an EJB method that is idempotent. This allows the failover handler to retry a failed call without knowing whether the call actually completed on the failed server. When you enable idempotent for a method, the EJB stub can automatically recover from any failure as long as it can reach another server hosting the EJB.

Note:

This annotation is overridden by the idempotent-method and retry-methods-on-rollback elements in the weblogic-ejb-jar.xml deployment descriptor. See weblogic-ejb-jar.xml Deployment Descriptor Reference in Developing Jakarta Enterprise Beans Using Deployment Descriptors.

Attributes

The following table summarizes the attributes.

Table A-3 Attributes of the weblogic.javaee.Idempotent

Name Description Data Type Required?

retryOnRollbackCount

Number of times to automatically retry container-managed transactions that have rolled back.

This attribute defaults to 0.

int

No

weblogic.javaee.JMSClientID

The following sections describe the annotation in more detail.

Description

Target: Class (message-driven EJBs only)

Specifies a client ID for the MDB when it connects to a JMS destination. Required for durable subscriptions to JMS topics.

If you specify the connection factory that the MDB uses in weblogic.javaee.MessageDestinationConfiguration, the client ID can be defined in the ClientID element of the associated JMSConnectionFactory element in config.xml.

If JMSConnectionFactory in config.xml does not specify a ClientID, or if you use the default connection factory, (you do not specify weblogic.javaee.MessageDestinationConfiguration) the MDB uses the jms-client-id value as its client id.

Note:

This annotation is overridden by the jms-client-id element in the weblogic-ejb-jar.xml deployment descriptor. See weblogic-ejb-jar.xml Deployment Descriptor Reference in Developing Jakarta Enterprise Beans Using Deployment Descriptors.

Attributes

The following table summarizes the attributes.

Table A-4 Attributes of the weblogic.javaee.JMSClientID

Name Description Data Type Required?

value

Client ID.

String

Yes

generateUniqueID

Flag that indicates whether or not you want the EJB container to generate a unique client ID for every instance of an MDB. Enabling this flag makes it easier to deploy durable MDBs to multiple server instances in a WebLogic Server cluster.

Boolean

No

Defaults to false.

weblogic.javaee.JNDIName

The following sections describe the annotation in more detail.

Description

Target: Type (a stateful, stateless, or singleton session-bean class, or one of its business interfaces)

Specifies a custom JNDI name that can be applied to a bean class for a certain client view. When applied to a bean class to indicate the JNDI name of a no-interface view, the className is optional.

Note:

This annotation is overridden by the jndi-binding element in the weblogic-ejb-jar.xml deployment descriptor. See weblogic-ejb-jar.xml Deployment Descriptor Reference in Developing Jakarta Enterprise Beans Using Deployment Descriptors.

Attributes

The following table summarizes the attributes.

Table A-5 Attributes of the weblogic.javaee.JNDIName

Name Description Data Type Required?

className

Client-view class. Defaults to Object.class; it may be omitted only when the bean exposes exactly one client view.

Class<?>

No

value

JNDI name of the client view.

String

Yes

weblogic.javaee.JNDINames

The following sections describe the annotation in more detail.

Description

Target: Class (Stateful or stateless session EJBs only)

Specifies the multiple, custom JNDI names that can be applied to an EJB.

Attributes

The following table summarizes the attributes.

Table A-6 Attributes of the weblogic.javaee.JNDINames

Name Description Data Type Required?

value

Multiple, custom JNDI names for the EJB.

JNDIName

No

weblogic.javaee.MessageDestinationConfiguration

The following sections describe the annotation in more detail.

Description

Target: Class (Message-driven EJBs only)

Specifies the JNDI name of the JMS Connection Factory that a message-driven EJB looks up to create its queues and topics.

Note:

This annotation is overridden by the connection-factory-jndi-name element in the weblogic-ejb-jar.xml deployment descriptor. See weblogic-ejb-jar.xml Deployment Descriptor Reference in Developing Jakarta Enterprise Beans Using Deployment Descriptors.

Attributes

The following table summarizes the attributes.

Table A-7 Attributes of the weblogic.javaee.MessageDestinationConfiguration

Name Description Data Type Required?

connectionFactoryJNDIName

Connection factory JNDI name. This attribute defaults to an empty string.

String

No

initialContextFactory

WebLogic initial context factory. This attribute defaults to weblogic.jndi.WLInitialContextFactory.class.

Class

No

providerURL

URL of the provider.

This attribute defaults to an empty string. When it is empty, the annotation processor does not set provider-url.

String

No

weblogic.javaee.TransactionIsolation

The following sections describe the annotation in more detail.

Description

Target: Method

Method-level transaction isolation settings for an EJB.

Note:

This annotation is overridden by the transaction-isolation element in the weblogic-ejb-jar.xml deployment descriptor. A matching method entry in the descriptor takes precedence. See weblogic-ejb-jar.xml Deployment Descriptor Reference in Developing Jakarta Enterprise Beans Using Deployment Descriptors.

Attributes

The following table summarizes the attributes.

Table A-8 Attributes of the weblogic.javaee.TransactionIsolation

Name Description Data Type Required?

value

Isolation level. Valid values include:

  • READ_COMMITTED—Transaction can view only committed updates from other transactions.

  • READ_UNCOMIMTTED—Transactions can view uncommitted updates from other transactions.

  • REPEATABLE_READ—Once the transaction reads a subset of data, repeated reads of the same data return the same values, even if other transactions have subsequently modified the data.

  • SERIALIZABLE—Simultaneously executing this transaction multiple times has the same effect as executing the transaction multiple times in a serial fashion.

int

Yes

weblogic.javaee.TransactionTimeoutSeconds

The following sections describe the annotation in more detail.

Description

Target: Class

Defines the timeout for transactions in seconds.

Attributes

The following table summarizes the attributes.

Table A-9 Attributes of the weblogic.javaee.TransactionTimeoutSeconds

Name Description Data Type Required?

value

Transaction timeout value in seconds. This attribute defaults to 30 (seconds).

int

No