A EJB Metadata Annotations Reference
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.
Parent topic: EJB Metadata Annotations Reference
WebLogic Annotations
This section provides reference information for WebLogic annotations.
- weblogic.javaee.AllowRemoveDuringTransaction
- weblogic.javaee.CallByReference
- weblogic.javaee.DisableWarnings
- weblogic.javaee.EJBReference
- weblogic.javaee.Idempotent
- weblogic.javaee.JMSClientID
- weblogic.javaee.JNDIName
- weblogic.javaee.JNDINames
- weblogic.javaee.MessageDestinationConfiguration
- weblogic.javaee.TransactionIsolation
- weblogic.javaee.TransactionTimeoutSeconds
Parent topic: EJB Metadata Annotations Reference
weblogic.javaee.AllowRemoveDuringTransaction
The following sections describe the annotation in more detail.
Parent topic: WebLogic Annotations
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.
Parent topic: weblogic.javaee.AllowRemoveDuringTransaction
weblogic.javaee.CallByReference
The following sections describe the annotation in more detail.
Parent topic: WebLogic Annotations
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.
Parent topic: weblogic.javaee.CallByReference
weblogic.javaee.DisableWarnings
The following sections describe the annotation in more detail.
Parent topic: WebLogic Annotations
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.
Parent topic: weblogic.javaee.DisableWarnings
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:
|
String |
Yes |
Parent topic: weblogic.javaee.DisableWarnings
weblogic.javaee.EJBReference
The following sections describe the annotation in more detail.
Parent topic: WebLogic Annotations
Description
Target: Class, Method, Field
Maps EJB reference name to its JNDI name.
Parent topic: weblogic.javaee.EJBReference
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 |
Parent topic: weblogic.javaee.EJBReference
weblogic.javaee.Idempotent
The following sections describe the annotation in more detail.
Parent topic: WebLogic Annotations
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.
Parent topic: weblogic.javaee.Idempotent
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 |
Parent topic: weblogic.javaee.Idempotent
weblogic.javaee.JMSClientID
The following sections describe the annotation in more detail.
Parent topic: WebLogic Annotations
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.
Parent topic: weblogic.javaee.JMSClientID
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 |
Parent topic: weblogic.javaee.JMSClientID
weblogic.javaee.JNDIName
The following sections describe the annotation in more detail.
Parent topic: WebLogic Annotations
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.
Parent topic: weblogic.javaee.JNDIName
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 |
Parent topic: weblogic.javaee.JNDIName
weblogic.javaee.JNDINames
The following sections describe the annotation in more detail.
Parent topic: WebLogic Annotations
Description
Target: Class (Stateful or stateless session EJBs only)
Specifies the multiple, custom JNDI names that can be applied to an EJB.
Parent topic: weblogic.javaee.JNDINames
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 |
Parent topic: weblogic.javaee.JNDINames
weblogic.javaee.MessageDestinationConfiguration
The following sections describe the annotation in more detail.
Parent topic: WebLogic Annotations
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.
Parent topic: weblogic.javaee.MessageDestinationConfiguration
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 |
Class |
No |
|
providerURL |
URL of the provider. This attribute defaults to |
String |
No |
Parent topic: weblogic.javaee.MessageDestinationConfiguration
weblogic.javaee.TransactionIsolation
The following sections describe the annotation in more detail.
Parent topic: WebLogic Annotations
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.
Parent topic: weblogic.javaee.TransactionIsolation
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:
This attribute defaults to DEFAULT. |
int |
No |
Parent topic: weblogic.javaee.TransactionIsolation
weblogic.javaee.TransactionTimeoutSeconds
The following sections describe the annotation in more detail.
Parent topic: WebLogic Annotations
Description
Target: Class
Defines the timeout for transactions in seconds.
Parent topic: weblogic.javaee.TransactionTimeoutSeconds
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 |
Parent topic: weblogic.javaee.TransactionTimeoutSeconds