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 or stateless sessions EJBs only)

Flag that specifies whether parameters are copied—or passed by reference—regardless of whether the EJB is called remotely or from within the same EAR.

Note:

Method parameters are always passed by value when an EJB is called remotely. 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?

WarningCode

Specifies the warning code. Set this element to one of the following four values:

  • BEA-010001—Disables this warning message: "EJB class loaded from system classpath during deployment."

  • BEA-010054—Disables this warning message: "EJB class loaded from system classpath during compilation."

  • BEA-010200—Disables this warning message: "EJB impl class contains a public static field, method or class."

  • BEA-010202—Disables this warning message: "Call-by-reference not enabled."

String

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

Yes

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: Class

Specifies an EJB that is written in such a way that repeated calls to the same method with the same arguments has exactly the same effect as a single call. This allows the failover handler to retry a failed call without knowing whether the call actually compiled 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: Method

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

No

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.

Class

No

weblogic.javaee.JNDIName

The following sections describe the annotation in more detail.

Description

Target: Class (Stateful or stateless session EJBs only)

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

Class name of the client view.

String

No

value

JNDI name of the client view.

String

No

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 t3://localhost:7001.

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 trans-timeout-seconds 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-8 Attributes of the weblogic.javaee.Idempotent

Name Description Data Type Required?

IsolationLevel

Isolation level. Valid values include:

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

  • READ_UNCOMITTED—Transactions can view uncomitted 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.

This attribute defaults to DEFAULT.

int

No

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