<ejbdoclet/> Task

This task allows you to generate various EJB-related files using nested subtasks and template files.

You no longer view EJBeans as a bunch of interfaces and deployment descriptor files. You simply program your component and ejbdoclet does the rest, from generating component and home interfaces to deployment descriptor. The point is that you program your component and specify its meta-data in a per component fashion, you don't have to deal with monolithic ejb-jar.xml files, you set the deployment meta-data per component. You don't have to worry about outdating deployment meta-data whenever you touch the code. The deployment meta-data is continuously integrated. And the whole process is, in its nature, round-trip.

This page outlines the ant subtask, and also the class and method level tags that affect this task.

See Parameters And Nested Elements Applicable To All Doclet Tasks.

Attribute Description Required
ejbspec The version of EJB spec ejbdoclet should adhere, currently "1.1" and "2.0" defined. If, for example, "2.0" specified, then ejbdoclet will generate EJB 2.0-compatible ejb-jar.xml file. No, default is "2.0"
ejbClassNameSuffix A comma-separated list of endings which should be removed from the bean class name to generate a bean's name if no name parameter is specified in the @ejb:bean tag. No, default is "Bean,EJB,Ejb"

Nested Elements

packageSubstitution

It's good practice to put interfaces (such as remote/local interfaces, data objects and home interfaces) in a separate "interfaces" package than in EJB bean implementation package. In previous versions of XDoclet it dictated this behavior, so if package name of a bean ended with .beans or .ejb interfaces were put into .interfaces package. It's no more the case. You have full control over it. If you don't put a <packageSubstitution .../> then all interfaces are generated to the same package of the bean implementation class. But if you want to follow the pattern and put interfaces into a separate package you can, by providing the list of package name tails that interfaces of beans inside that packages should be placed into the package you define. For example interfaces of test.ejb.CustomerBean will be placed in test.interfaces by the following packageSubstitution:

<packageSubstitution packages="ejb,beans" substituteWith="interfaces"/>

Parameters

Attribute Description Required
packages Comma-separated list of package names. Yes
substituteWith The package name that packages are substituted with. Yes

dataobject

Creates "data objects" for EJB beans.

Parameters

Attribute Description Required
pattern The pattern by which the data object classes are named. {0}designates the EJB name. No, default is "{0}Data"
destdir Destination directory for output data object files. No, default is destdir parameter of ejbdoclet task
templatefile The template file by which the data object classes are generated. No, default is "dataobject.j" in jar file of ejbdoclet itself
mergedir Merge directory where ejbdoclet looks for files to be merged with generated files. No, required, if the merge feature used

Merge Points

Merge File Name Description Required
dataobject-custom.j The file where custom code can be included. No

Nested Elements

remoteinterface - localinterface

Creates "remote / local interfaces" for EJB beans.

Parameters

Attribute Description Required
pattern The pattern by which the interfaces are named. {0}designates the EJB name. No, default is "{0}"
destdir Destination directory for output interface files. No, default is destdir parameter of ejbdoclet task
templatefile The template file by which the interfaces are generated. No, default is "remote.j" in jar file of ejbdoclet itself
mergedir Merge directory where ejbdoclet looks for files to be merged with generated files. No, required, if the merge feature used

Merge Points

Merge File Name Description Required
remote-custom.j - local-custom.j The file where custom code can be included. No

Nested Elements

homeinterface - localhomeinterface

Creates "home / local home interfaces" for EJB beans.

Parameters

Attribute Description Required
pattern The pattern by which the interfaces are named. {0}designates the EJB name. No, default is "{0}Home"
destdir Destination directory for output interface files. No, default is destdir parameter of ejbdoclet task
templatefile The template file by which the interfaces are generated. No, default is "home.j" in jar file of ejbdoclet itself
mergedir Merge directory where ejbdoclet looks for files to be merged with generated files. No, required, if the merge feature used

Nested Elements

entitypk

Creates "primary key classes" for entity EJB beans.

Parameters

Attribute Description Required
pattern The pattern by which the primary key classes are named. {0}designates the EJB name. No, default is "{0}PK"
destdir Destination directory for output primary key class files. No, default is destdir parameter of ejbdoclet task
templatefile The template file by which the primary key classes are generated. No, default is "entitypk.j" in jar file of ejbdoclet itself
mergedir Merge directory where ejbdoclet looks for files to be merged with generated files. No, required, if the merge feature used

Nested Elements

entitybmp

Creates "entity bean classes" for BMP entity EJB beans. The classes are derived from the abstract entity bean class.

Attention:To give the developer more control over when the EJB becomes dirty (data changed) there is now a method called "makeDirty()" in the generated wrapper class. To use this please add to your EJB an abstract method called "makeDirty" and call it when you change data w/o using the setter methods. As example you could store the Data Object instead of storing all the attributes one by one (be aware that you have to clone the data object before storing to avoid side effects).

Parameters

Attribute Description Required
pattern The pattern by which the entity bean classes are named. {0}designates the EJB name. No, default is "{0}BMP"
destdir Destination directory for output entity bean class files. No, default is destdir parameter of ejbdoclet task
templatefile The template file by which the entity bean classes are generated. No, default is "entitybmp.j" in jar file of ejbdoclet itself
mergedir Merge directory where ejbdoclet looks for files to be merged with generated files. No, required, if the merge feature used

Merge Points

Merge File Name Description Required
entitybmp-custom.j The file where custom code can be included. No

Nested Elements

entitycmp

Creates "entity bean classes" for CMP entity EJB beans. The classes are derived from the abstract entity bean class.

Parameters

Attribute Description Required
pattern The pattern by which the entity bean classes are named. {0}designates the EJB name. No, default is "{0}CMP"
destdir Destination directory for output entity bean class files. No, default is destdir parameter of ejbdoclet task
templatefile The template file by which the entity bean classes are generated. No, default is "entitycmp.j" in jar file of ejbdoclet itself
mergedir Merge directory where ejbdoclet looks for files to be merged with generated files. No, required, if the merge feature used
cmpspec The CMP spec to use. Possible values are 1.x or 2.x. No, default is 2.x. It can be defined at bean level as well.

Merge Points

Merge File Name Description Required
entitycmp-custom.j The file where custom code can be included. No

Nested Elements

dao

Creates abstract data access object (DAO) interfaces for EJBs.

The DAO interfaces will contain any methods flagged as using a DAO call (with a @dao:call method-level tag). Currently, only BMP entity beans are supported (support for DAOs with the other EJB types is planned e.g. for accessing a database directly with JDBC in a session bean). In addition to the flagged methods, the DAO will contain methods for use by the ejbLoad, ejbStore and ejbRemove methods in the generated BMP class.

To use the generated DAOs, you must supply your own implementation class with the specific JDBC (or other) code. The generated BMP class will contain code for obtaining a DAO instance, and calling its methods.

Parameters

Attribute Description Required
pattern The pattern by which the DAO classes are named. {0}designates the EJB name. No, default is "{0}DAO"
destdir Destination directory for output DAO class files. No, default is destdir parameter of ejbdoclet task
templatefile The template file by which the DAO classes are generated. No, default is "dao.j" in jar file of ejbdoclet itself
mergedir Merge directory where ejbdoclet looks for files to be merged with generated files. No, required, if the merge feature used

Merge Points

Merge File Name Description Required
dao-custom.j The file where custom code can be included. No

Nested Elements

session

Creates "session bean classes" for Session EJB beans. The classes are derived from the (abstract) session bean class. This has less importance than for entity bean and is there only for customs changes to session-custom.j.

Parameters

Attribute Description Required
pattern The pattern by which the session bean classes are named. {0}designates the EJB name. No, default is "{0}Session"
destdir Destination directory for output entity bean class files. No, default is destdir parameter of ejbdoclet task
templatefile The template file by which the entity bean classes are generated. No, default is "session.j" in jar file of ejbdoclet itself
mergedir Merge directory where ejbdoclet looks for files to be merged with generated files. No, required, if the merge feature used

Merge Points

Merge File Name Description Required
session-custom.j The file where custom code can be included. No

Nested Elements

deploymentdescriptor

Creates "EJB standard-compliant deployment descriptors (ejb-jar.xml file)" for EJB beans.

Parameters

Attribute Description Required
xmlencoding The encoding of the ejb-jar.xml file. No, default is "UTF-8"
destdir Destination directory for output deployment descriptor file. No, default is destdir parameter of ejbdoclet task
mergedir Merge directory where ejbdoclet looks for files to be merged with generated files. No, required, if the merge feature used
validateXml Validates the generated xml file according to the DTD file contained inside xdoclet.jar. No, default is false

Merge Points

Merge File Name Description Required
ejb-env-entries-{0}.xml The file where environment entries are defined. {0}designates the EJB name. See <env-entry> in EJB spec. No
ejb-ejbrefs-{0}.xml The file where EJB references are defined. {0}designates the EJB name. See <ejb-ref> in EJB spec. No
ejb-sec-rolerefs-{0}.xml The file where security role references are defined. {0}designates the EJB name. See <security-role-ref> in EJB spec. No
ejb-resourcerefs-{0}.xml The file where resource references are defined. {0}designates the EJB name. See <resource-ref> in EJB spec. No
ejb-security-roles.xml The file where EJB security role references are defined. It should be located at root of mergedir. See <security-role> in EJB spec. No

Remember you should preserve the package directory structure in mergedir. If the bean is test.bank.AccountBean then ejb-env-entries-Account.xml should be located at test/bank directory in mergedir.

utilobject

Cretes utility classes for EJBs. Currently utility classes can be used for convenient home/local home interface lookups. The generated util classes can be tuned with the @ejb:util tag.

Parameters

Attribute Description Required
pattern The pattern by which the entity bean classes are named. {0}designates the EJB name. No, default is "{0}Util"
destdir Destination directory for output entity bean class files. No, default is destdir parameter of ejbdoclet task
templatefile The template file by which the entity bean classes are generated. No, default is "util.j" in jar file of ejbdoclet itself
mergedir Merge directory where ejbdoclet looks for files to be merged with generated files. No, required, if the merge feature used. BUte there are no merge point defined at this time
kind The preferred kind of lookup method. Valid values are "physical" (for looking up from global jndi tree) or "logical" (for looking up using logical ejb name). You can specify the value for a specific class by using @ejb:util tag. No, "logical" is the default

Nested Elements

Class level Tags

With only one attribute, you don't have to remember the name of the property, but because the value can have spaces in it, it makes more sense to use the "quoted" format.

With multiple attributes, it would be difficult to remember the order in which you have to put the values, that's why using the "name-value pairs" format is the unique format.

@ejb:bean

The ejb:bean tag provides information about the EJB. It is the one compulsory tag for all EJBs, however not all parameters are applicable for all types of beans, and some parameters apply differently for different types of bean.

Parameter Applicability Usage
name: String All beans. Provides the name of the bean that will be used in the ejb-jar.xml deployment descriptor.
display-name: String All beans. The display name of the bean.
small-icon: String All beans. The small icon for the bean.
large-icon: String All beans. The large icon for the bean.
generate: boolean All beans. Set it to "false" if you want the class be excluded from list of EJBs. This is useful for abstract EJBs that other EJBs are to derive from. So you obviously do not want the abstract EJB be wrongly specified in deployment desciptors as a concrete EJB. Default is "true".
jndi-name: String Remote Session and Entity beans Provides the JNDI name of the bean that will be used in the vendor specific deployment descriptors.
local-jndi-name: String Local Session and Entity beans (EJB2.0 only) Provides the JNDI name of the bean that will be used in the vendor specific deployment descriptors. It's the JNDI name for the local EJB.
[view-type]: String ( "local", "remote"* or "both") Session and Entity beans (EJB2.0 only) Indicates what view-type(s) is(are) supported by the bean. If not specified, it's assumed that the bean is remote.
type: String ( "Stateful", "Stateless", "CMP", "BMP") Session and Entity beans Defines the bean's "type". For session beans this is either Stateful or Stateless. For Entities it is CMP or BMP
transaction-type: String ( "Container"*, "Bean") Session and Message-driven beans Defines the bean's transaction type.
reentrant: boolean Entity Defines the entity bean's reentrancy.
cmp-version: String ( "1.x", "2.x" ) Entity beans, EJB2.0 only Defines the version of the spec the bean is for CMP. If not set, default comes entitycmp subtask's cmpspec value.
schema: String Entity beans, EJB2.0 only Defines the abstract schema name for the bean.
primkey-field: String Entity beans Defines the primary key field for the bean as per spec.
use-soft-locking: boolean Entity beans If true, then generate a public int version attribute in the uto-generated concrete class, to form a optimistic locking mechianism. The value of version attribute is incremented in ejbStore. The default is false.

Note: It's applicable to both CMP and BMP, but many containers have optimistic locking capabilities built-in, so you don't need to worry about it locking issues.

message-selector: String Message-driven beans Defines an optional message selector for MDB.
acknowledge-mode: String ( "Auto-acknowledge", "Dups-ok-acknowledge" ) Message-driven beans Defines the acknowledge mode for MDB.
destination-type: String ( "javax.jms.Queue", "javax.jms.Topic" ) Message-driven beans Defines the type of destination for MDB.
subscription-durability: String ( "Durable", "NonDurable" ) Message-driven beans Defines the durability of messages for MDB as per EJB2.0 spec.
remote-business-interface: String Session and Entity Beans Defines the remote business interface for the bean. If present, ejb:interface-method tags are not required, instead the remote interface will extend the business interface. The business interface must declare all methods as throwing RemoteException as per the business interface pattern.
local-business-interface: String Session and Entity Beans, EJB2.0 only Defines the local business interface for the bean. Similar to remote-business-interface but the interface does not need to declare RemoteException in the throws clause.

@ejb:home

The @ejb:home tag provides information about an Entity or Session Bean's home interface. It is not applicable for Message-driven beans. All parameters are applicable to both Entity and Session beans.

Parameter Usage
extends: String Declare which interface the generated home interface should extend. Default is "javax.ejb.EJBHome".
local-extends: String Declare which interface the generated local home interface should extend. Default is "javax.ejb.EJBLocalHome". EJB2.0 only
generate: none|(local?,remote?) Which home interfaces should be generated. Defaults to both (only generated if relevant), can be "none", "remote", "local", or "local, remote". The "local" value is only applicable to EJB2.0
remote-class: String The fully qualified name of the remote home interface.
local-class: String The fully qualified name of the local home interface. EJB2.0 only.
remote-pattern: String The pattern to be used in determining the unqualified name of the remote home interface - only used if remote-class is not present.
local-pattern: String The pattern to be used in determining the unqualified name of the local home interface - only used if local-class is not present. EJB2.0 only
pattern: String The pattern to be used in determining the unqualified name of either local or remote home interfaces. Used where -class and -pattern tags are absent for the bean.
remote-package: String The package the remote home interface should be in - only used where remote-class is not present. Use <packageSubstitution/> to configure which package the interface should end up in.
local-package: String The package the local home interface should be in - only used where local-class is not present. EJB2.0 only. Use <packageSubstitution/> to configure which package the interface should end up in.
package: String The package for the home interfaces to be placed in. Only used where -class and -package are not present. Use <packageSubstitution/> to configure which package the interface should end up in.

@ejb:interface

The @ejb:interface tag provides information about an Entity or Session Bean's component interfaces (remote and/or local). It is not applicable to Message-driven beans. All parameters are applicable to both Entity and Session beans.

Parameter Usage
extends: String Declare which interface the generated remote interface should extend. Default is "javax.ejb.EJBObject".
local-extends: String Declare which interface the generated local interface should extend. Default is "javax.ejb.EJBLocalObject". EJB2.0 only.
generate: none|(local,remote) Which interfaces should be generated. Defaults to both (only generated if relevant), can be "none", "remote", "local", or "local, remote".
remote-class: String The fully qualified name of the remote interface.
local-class: String The fully qualified name of the local interface. EJB2.0 only.
remote-pattern: String The pattern to be used in determining the unqualified name of the remote interface - only used if remote-class is not present.
local-pattern: String The pattern to be used in determining the unqualified name of the local interface - only used if local-class is not present. EJB2.0 only.
pattern: String The pattern to be used in determining the unqualified name of either local or remote interfaces. Used where -class and -pattern tags are absent for the bean.
remote-package: String The package the remote interface should be in - only used where remote-class is not present. Use <packageSubstitution/> to configure which package the interface should end up in.
local-package: String The package the local interface should be in - only used where local-class is not present. EJB2.0 only. Use <packageSubstitution/> to configure which package the interface should end up in.
package: String The package for the interfaces to be placed in. Only used where -class and -package are not present. Use <packageSubstitution/> to configure which package the interface should end up in.

@ejb:finder

Defines a finder method for the home interface. Applicable only to Entity beans. An entity bean may have zero or more ejb:finder tags.

Parameter Usage
[signature]: String Defines the signature of the method. E.g.. "java.util.Collection findAll()". The return type in the signature must be fully qualified.
[unchecked]: boolean Flags the finder as having unchecked permission. EJB2.0 only. If present, role-name must be omitted
[role-name]: list A comma-separated list of roles that can invoke this finder method.
[query]: String EJB-QL query for the finder. Applicable to EJB2.0 CMP only.
[result-type-mapping]: none|(Local,Remote) Result type mapping for the finder method. Applicable to EJB2.0 CMP only.
[method-intf]: String Indicates the interface (Home or LocalHome) for which the finder permissions should be set. Applies only if role-name or unchecked is specified. If the permissions should apply to both Home or LocalHome interfaces, this parameter should not be specified.

@ejb:select

Defines a select method for the home interface. An entity bean may have zero or more ejb:select tags. Applicable to EJB2.0 CMP only.

Parameter Usage
[signature]: String Defines the signature of the method. E.g.. "java.util.Collection selectAll()". The return type in the signature must be fully qualified.
[query]: String EJB-QL query for the select method.
[result-type-mapping]: none|(local,remote) Result type mapping for the select method.

@ejb:util

This tag is optional, and lets you define whether or not a util class should be generated, and whether to use the logical component name (java:comp/env) or the physical JNDI name to do the lookup. If this tag is not specified, the util class will be generated using logical lookups (provided the <utilobject> subtask is used)

Parameter Usage
[generate]: (false|no|logical|physical) false or no will omit the generation of the util class. logical will generate a util class that uses the component name for lookup, and physical will generate a class that uses the JNDI name for lookups. Default is logical.

@ejb:pk

Defines the primary key of an entity bean. If the <entitypk/> subtask is included, then primary key classes will be generated for all entity beans unless a generate="false" parameter is present, or the primary class is in the java.lang package.

Parameter Usage
[class]: String The fully qualified name of the primary key class. If absent the primary key class name will be determined using the pattern and package parameters.
[pattern]: String Define the pattern (using {0} for the EJB name) to be used for constructing the unqualified (package specific) name of the primary key class.
[package]: String Define the package the pk class is in (generated or not). Use <packageSubstitution/> to configure which package the PK class should end up in.
[generate]: boolean Indicate if the primary key class should be generated. Defaults to true
[extends]: String Define which class the generated pk must extend.
[implements]: String Define which interface the generated pk must implement.
[ver-uid]: String Define the value of a serialVersionUID attribute that will be set in the class. Note that by default ejbdoclet generates a valid serialVersionUID field in the generated PK class. The value of the generated serialVersionUID is equal to the one generated by serialver.exe of JDK. So you can use what ejbdoclet generates with no problem.
[role-name]: list A comma-separated list of roles that can execute findByPrimaryKey
[unchecked]: boolean Flags the PK-finder as having unchecked permission. EJB2.0 only. If present, role-name must be omitted
[method-intf]: String Indicates the interface (Home or LocalHome) for which the findByPrimaryKey permissions should be set. Applies only if role-name or unchecked is specified. If the permissions should apply to both Home or LocalHome interfaces, this parameter should not be specified.

@ejb:data-object

Defines configuration attributes used for data object generation. Applicable only for Entity beans.

Parameter Usage
[extends]: String Declare which class the generated bulk data class should extend. Default is "java.lang.Object". The class must be java.io.Serializable. This is useful if you want to add some methods that should always be available in bulk data objects.
[implements]: list Declare a set of interfaces (comma-separated list) that the generated data object class should implement. "java.io.Serializable" is always added to this list.
[package]: String Define the package the data object class is in. Use <packageSubstitution/> to configure which package the data-object class should end up in.
[ver-uid]: Long Define the value of a serialVersionUID attribute that will be set in the class. Note that by default ejbdoclet generates a valid serialVersionUID field in the generated PK class. The value of the generated serialVersionUID is equal to the one generated by serialver.exe of JDK. So you can use what ejbdoclet generates with no problem.
[container]: boolean If set and set to "false" the ejbdoclet will not generate a Bulk Data Container nor a setter method. Thus it will make all other "data" settings obsolete. This is usefull when you want to use inheritance within your data container classes.
[setdata]: boolean If set and set to "false" the ejbdoclet will not generate a "setData()" method. Therefore you are you are free to use your own method.
[equals]: boolean If set and set to "false" the ejbdoclet will not generate an "equals()" method. Therefore you are free to use your own method.
[use-super-equals]: boolean If set and set to "true" the ejbdoclet will generate an "equals()" method that first calls super.equals() to check for superclass equivalence. This allows for adding to the dataobject in the superclass. If true, the generated hashCode() method will also start with super.hashCode().

@ejb:dao

Defines the data access object of an entity bean. If the <dao/> subtask is included, then DAO interfaces will be generated for any entity beans containing this tag, unless a generate="false" parameter is present.

Parameter Usage
[class]: String The fully qualified name of the DAO interface. If absent the interface name will be determined using the pattern and package parameters.
[pattern]: String Define the pattern (using {0} for the EJB name) to be used for constructing the unqualified (package specific) name of the DAO interface.
[package]: String Define the package the DAO interface is in (generated or not). Use <packageSubstitution/> to configure which package the interface should end up in.
[generate]: boolean Indicate if the DAO interface should be generated. Defaults to true.
[impl-class]: String The fully qualified name of a class which implements the DAO interface. If present, then generated code for obtaining a DAO will just create a new instance of this class.
[impl-jndi]: String Indicates a JNDI environment reference which will contain a String that is the fully qualified name of a class implementing the DAO interface. If present, then generated code for obtaining a DAO will look up this reference, then create a new instance of the class whose name is found there. This allows the actual implementation class to be determined at runtime.

@ejb:env-entry

Defines an environment entry for an EJB. Applicable to all EJB types.

name of java type type that has the
value of value. type is optional, the default is java.lang.Sting.
Parameter Usage
name: String The name of the env-entry
type: String The type of the env-entry, eg java.lang.String. Supported types outlined in the EJB spec.
value: dependent on type
The value of the env-entry.

@ejb:ejb-ref

Defines an EJB-reference. Applicable to all EJB types. Attention You have to import the referred class (the ejbdoclet one) even your EJB does not need it.

to the bean with EJB-name ejb-name. ref-name is optional and if not specified then the reference name is ejb-name prefixed by a ejb/.
Parameter Usage
ejb-name: String The name of the EJB being referenced.
[view-type]: "local" | "remote" The view type that the reference uses.
[ref-name: String] The name that the referenced bean will be referred to by. For example, to refer to the bean Customer as java:comp/env/ejb/Customer name should be ejb/Customer. Defaults to ejb/[ejb-name], where [ejb-name] is the named of the referenced bean (Customer) prefixed by "ejb/".

@ejb:ejb-external-ref

Defines an EJB-reference to a bean in another application.of type type, name of reference bean's home interface home, name of
reference bean's remote interface remote. Applicable to all types of beans.

Parameter Usage
ref-name: String The name that the referenced bean will be referred to by. For example, to refer to the bean Customer as java:comp/env/ejb/Customer name should be ejb/Customer. Defaults to ejb/[ejb-name], where [ejb-name] is the named of the referenced bean (Customer) prefixed by "ejb/".
ejb-name: String The name that the referenced bean will be referred to by. For example, to refer to the bean Customer as java:comp/env/ejb/Customer name should be ejb/Customer. Defaults to ejb/[ejb-name], where [ejb-name] is the named of the referenced bean (Customer) prefixed by "ejb/".

* Deprecated. Use ref-name instead.

type: "Entity" | "Session" The type of EJB being referenced.
home: String The fully qualified class name of the home interface of the referenced bean.
remote: String The fully qualified class name of the remote interface of the referenced bean.

@ejb:resource-ref

Defines a resource reference with the name res-name to a resource of type res-type, and the authentication is done by the one specified in res-auth. Applicable to all EJB types.

Parameter Usage
[res-name]: String The resource name.
[res-type]: String The resource type.
[res-auth]: "Container" | "Application" The resource authentication type.

@ejb:resource-env-ref

Defines a resource environment reference with the name name to a resource of type type. Applicable to all EJB types.
Parameter Usage
[name]: String The name of the resource.
[type]: String The type of the resource.

@ejb:security-role-ref

Defines a security role reference with the name role-name to a security role link named role-link. Applicable to Entity and Session beans.

Parameter Usage
role-name: String The name of the role reference.
[role-link]: String The name of the role link.

@ejb:transaction

Defines the transactional behaviour for all methods in remote and home interfaces of this bean with transaction type of type. Can be overridden by using transaction tags on individual methods.

Parameter Usage
type: "NotSupported" | "Supports" | "Required" | "RequiresNew" | "Mandatory" | "Never" The transactional type for the bean's methods.

@ejb:permission

Allow the role role-name to call all methods in remote and home interfaces of this bean. Applicable to Entity and Session beans.

Parameter Usage
role-name: list Comma separated list of roles that is given permission to invoke the methods on this bean.
[unchecked]: String Declare the methods in the bean as unchecked. EJB2.0 only.

@ejb:security-identity

The security-identity element specifies whether the caller’s security identity is to be used for the execution of the methods of the enterprise bean or whether a specific run-as identity is to be used. It contains an optional description and a specification of the security identity to be used. Applicable to Entity, Session and Message Driven beans.
EJB2.0 only.

Parameter Usage
[description]: String The description of the security identity.
[use-caller-identity]: String The use-caller-identity element specifies that the caller’s security identity be used as the security identity for the execution of the enterprise bean’s methods.
[run-as]: String The run-as element specifies the run-as identity to be used for the execution of the methods of an enterprise bean. It contains an optional description, and the name of a security role.

Method level Tags

@ejb:relation

Define a relationship for an Entity bean. Applicable only to EJB2.0 CMP2.x beans.

Parameter Usage
name: String Name of the relation. For bidirectional relationships, specify the same name on both sides.
role-name: String Name of a relationship role.
[cascade-delete]: String Indicates whether or not the app server should perform cascade deletes. If yes, specify cascade-delete="yes"
[target-ejb]: String Name of the EJB on the other side of the relation. Should *only* occur if the relation is unidirectional.
[target-role-name]: String Name of the relationship role on the other side of the relation. Should *only* occur if the relation is unidirectional.
[target-cascade-delete]: String Indicates whether or not the app server should perform cascade deletes for the other side of the relation. If yes, specify cascade-delete="yes". Should *only* occur if the relation is unidirectional.
[target-multiple]: String If this EJB represents a many-side of the other side of the relation, specify target-multiple="yes". If not, just don't use this parameter, or specify "no". Should *only* occur if the relation is unidirectional.

@ejb:interface-method

Declare in which interface (local/remote) this method must appear. If the view-type parameter is absent then the method will be added to whatever component interfaces are defined in @ejb:bean.

Parameter Usage
[view-type]: "local" | "remote" | "both" Optionally specify which view-type the method will be exposed in. The value "local" or "both" is only applicable to EJB2.0 beans.

@ejb:home-method

Define this method as a home method (e.g. its name is "ejbHomefoo", and the corresponding home method should be defined in the home interface). Applicable to session and entity beans - valid for EJB2.0 only.

Parameter Usage
[view-type]: "local" | "remote" Optionally specify which view-type the method will be exposed in.

@ejb:create-method

The method is an ejbCreate method and will be included in the home interface. It is applicable to Session and Entity beans. In Stateless Session beans the ejbCreate will be created if it is not in the code.

Parameter Usage
[view-type]: "local" | "remote" Optionally specify which view-type the method will be exposed in.

@ejb:persistent-field

Use this for methods with the following patterns:

This will create the CMP field "X" in the generated CMP layer of type "Foo", and concrete implementations of the getX/setX methods. For BMP, it will generate getX/setX methods that keep track of a dirty flag (so that ejbStore is only called if necessary). If the type is boolean it is ok to have the get method prefixed "is" instead of "get". If you don't define the setter method, no setter method is generated for the concrete BMP/CMP class (concrete CMP class is generated only if EJB 1.1 or EJB 2.0 but using CMP 1.x). This is useful for cases where for example nothing is set programmatically but via external sources such as a stored procedure. Applicable for entity beans.

@ejb:pk-field

Use this for methods with the following pattern: public abstract Foo getX(). This will denote the persistent field "X" as a primary key field, which will be included in the generated primary key class. Must be used with the persistent-field tag. This tag is only valid for EntityBeans. It has no parameters.

@ejb:aggregate

Mark a persistent field containing a reference to another entity bean as being aggregated in this bean. The data object will contain accessor methods for the aggregated entity's data object instead of a reference to the entity itself. The aggregated entity will also be removed when this entity is removed. For example, aggregates are useful for sending graphs of data to the client. This is only applicable to entity beans and has no parameters.

@ejb:transaction

Defines the transactional behavior for this method. Applicable to methods with @ejb:create-method and @ejb:interface-method tags.

Parameter Usage
[type]: "NotSupported" | "Supports" | "Required" | "RequiresNew" | "Mandatory" | "Never" Define the type of transactional behaviour.

@ejb:permission

Define a method's premission. Used with a method with an @ejb:interface-method or @ejb:create-method tag.

Parameter Usage
[role-name]: list Comma-separated list of roles allowed to call this method

@dao:call

The method is a call to a data access object; the method will be included in the DAO interface, and the EJB's generated subclass will contain a call to the DAO's method.

Parameter Usage
[name]: String Optionally specify the method's name in the DAO (it need not be the same as the calling method in the EJB). If not specified, the default is the usual interface equivalent of the method's name (i.e. generally the same, but ejbFindByX becomes findByX etc.)