@ejbgen:session Annotation

This tag defines the class-scope properties of a session bean.

Scope

Class tag on a session bean.

Syntax

@ejbgen:session

ejb-name="NameSessionBean"

[allow-concurrent-calls="True/False"]

[allow-remove-during-transaction="True/False"]

[bean-load-algorithm="NameAlgorithm"]

[cache-type="NRU/LRU"]

[call-router-class-name="ClassName"]

[clients-on-same-server="True/False"]

[create-as-principal-name="PrincipalName"]

[default-transaction="DefaultTransactionOption"]

[dispatch-policy="DispatchPolicyQueue"]

[enable-call-by-reference="True/False"]

[home-call-router-class-name="ClasName"]

[home-is-clusterable="True/False"]

[home-load-algorithm="LoadAlgorithmOption"]

[idle-timeout-seconds="TimeoutValue"]

[initial-beans-in-free-pool="InitialNumber"]

[is-clusterable="True/False"]

[max-beans-in-cache="MaxNumber"]

[max-beans-in-free-pool="MaxNumber"]

[methods-are-idempotent="True/False"]

[passivate-as-principal-name="PrincipalName"]

[persistent-store-dir="DirectoryName"]

[remove-as-principal-name="PrincipalName"]

[replication-type="InMemory/None"]

[run-as="RoleName"]

[run-as-identity-principal="PrincipalName"]

[trans-timeout-seconds="Seconds"]

[transaction-type="Bean/Container"]

[type="Stateless/Stateful"]

[use-caller-identity="True/False"]

Attributes

ejb-name

Required. Specifies the (descriptive) name of the session bean. When you create a new session bean with the file name <name>Bean.ejb or <name>.ejb, the ejb-name will be <name> by default.

allow-concurrent-calls

Optional. Specifies whether to allow concurrent calls for a stateful session bean. Valid values are true and false. When left unspecified, it defaults to false. If a second method call occurs while the session bean is still processing the previous method, and this attribute is set to true, the second method call will wait. If the waiting period exceeds the transaction time out (see below), a LockTimedOutException is thrown. If the attribute is not set to true, this exception is thrown immediately. Concurrent calls typically occur when a web user reloads/refreshes a page before the request initiated through this page has been completed by the session bean.

allow-remove-during-transaction

Optional. Specifies whether the remove method can be invoked during a transaction. Valid values are true and false. When the attribute is left unspecified, the default is false.

bean-load-algorithm

Optional. Specifies the algorithm to be used for load-balancing among replicas of a stateless session bean. Valid values are round-robin, weight-based, random, round-robin-affinity, weight-based-affinity, and random-affinity. When this attribute is left unspecified, the default is round-robin.

cache-type

Optional. Specifies the cache type for passivation of a stateful session bean. Valid values are NRU (not recently used, or eager passivation) and LRU (least recently used, or lazy passivation). If this attribute is left unspecified, the default is NRU. For more information, see The Life Cycle of a Session Bean.

call-router-class-name

Optional. Specifies the class name to be used for routing home method calls. This class must implement weblogic.rmi.cluster.

clients-on-same-server

Optional. Specifies whether all clients are co-located with the session bean on the same server. Valid values are true and false. When this attribute is left unspecified, its defaults to false. If set to True, the server instance will not multicast JNDI announcements for the EJB when it is deployed, that is, it turns off JNDI replication so that the EJB's JNDI name is only bound to the local server, hence reducing the startup time for large clusters.

create-as-principal-name

Optional. Specifies the name of the principal to be used when running the bean's ejbCreate method. For more information, see Role-Based Security.

default-transaction

Optional. Specifies the default transaction attribute to be applied to all methods that do not have a transaction attribute setting. Valid values are NotSupported, Supports, Required, RequiresNew, Mandatory, and Never. When the default-transaction is left unspecified, it defaults to Supports. When the transaction-type is set to Bean, the default-transaction attributed is ignored. For more information, see EJBs and Transactions.

dispatch-policy

Optional. Specifies the dispatch policy queue for this bean. If this attribute is not specified, the server's default execute thread pool is used.

enable-call-by-reference

Optional. Specifies whether the container will call this EJB by reference. When left unspecified this attribute defaults to False.

home-call-router-class-name

Optional. Specifies the name of a custom class to use for routing bean method calls.

home-is-clusterable

Optional. Specifies whether this bean can be deployed from multiple servers in a cluster. Valid values are true and false. If this attribute is not specified, it defaults to true.

home-load-algorithm

Optional. Specifies the algorithm to use for load-balancing between replicas of the EJB home. Valid values are RoundRobin, Random, WeightBased, RoundRobinAffinity, RandomAffinity, and WeightBasedAffinity.

idle-timeout-seconds

Optional. Specifies the maximum duration in seconds that an stateful session bean will stay in the cache before it is removed. The default is 600.

initial-beans-in-free-pool

Optional. Specifies the initial number of beans in the free pool. The default is 0.

is-clusterable

Optional. Specifies whether this bean is clusterable. Valid values are true and false. If this attribute is not specified, it defaults to true.

max-beans-in-cache

Optional. Specifies the maximum number of beans in cache. The default is 1000.

max-beans-in-free-pool

Optional. Specifies the maximum number of beans in the free pool.

methods-are-idempotent

Optional. Specifies whether the methods for a stateless session bean are idempotent. Valid values are true and false. When left unspecified, the default is false.

passivate-as-principal-name

Optional. Specifies the name of the principal to be used when running the bean's ejbPassivate method. For more information, see Role-Based Security.

persistent-store-dir

Optional. Specifies the directory in which to store passivated stateful beans.

remove-as-principal-name

Optional. Specifies the name of the principal to be used when running the bean's ejbRemove method. For more information, see Role-Based Security.

replication-type

Optional. Specifies whether to replicate stateful session beans in a cluster. Valid values are InMemory and None. When this attribute is left unspecified, the default is None.

run-as

Optional. Specifies the EJB-scoped security role this bean should run under. To use this attribute, use-caller-identity must be False. Also make sure that the security role is defined using the @ejbgen:role-mapping Annotation. For more information, see Role-Based Security.

run-as-identity-principal

Optional. Specifies the name of the principal to run as in case the security role specified with the run-as attribute maps to several principals. To specify this attribute you must also specify the run-as attribute. You must specify the run-as-identity-principal attribute when the run-as security role is externally defined. For more information, see Role-Based Security.

trans-timeout-seconds

Optional. Specifies the transaction timeout (in seconds). If not specified, this attribute defaults to 30 seconds.

transaction-type

Optional. Specifies who manages the transactions for this EJB. Valid values are Bean and Container. When not specified, this attribute defaults to Container. For more information, see EJBs and Transactions.

type

Optional. Valid values are Stateless and Stateful. When not specified, this attribute defaults to Stateless.

use-caller-identity

Optional. Specifies whether or not this EJB uses the caller's identity. When not specified, this attribute defaults to True. You must set this attribute to False to use the run-as and run-as-identity-principal attributes. For more information, see Role-Based Security.

Related Topics

Getting Started with Session Beans

Role-Based Security

EJBs and Transactions