Skip navigation.

Programming WebLogic Enterprise JavaBeans

  Previous Next vertical dots separating previous/next from contents/index/pdf Contents View as PDF   Get Adobe Reader

EJBGen Reference

EJBGen is an Enterprise JavaBeans 2.0 code generator. If you annotate your Bean class file with javadoc tags, you can use EJBGen to generate the Remote and Home classes and the deployment descriptor files for an EJB application.

BEA recommends that you use EJBGen to generate deployment descriptors; this BEA best practice allows for easier and simpler maintenance of EJBs. If you use EJBGen, you have to write and annotate only one bean class file, which simplifies writing, debugging and maintenance. If you use WebLogic Workshop as a development environment, WebLogic Workshop automatically inserts EJBGen tags for you. These sections provide instructions on using EJBGen and define EJBGen command options and tag.

 


Running EJBGen

These sections describe how to process an annotated bean file using EJBGen:

EJBGen Distribution and Examples

As of WebLogic Server 8.1 SP02, EJBGen and associated classes are not included in weblogic.jar; instead, they are provided as a separate archive—ejbgen.jar in the WL_HOME/server/lib of the WebLogic Server distribution. To use EJBGen, put ejbgen.jar in your CLASSPATH.

If you have installed BEA WebLogic 8.1 examples, see WL_HOME\samples\server\examples\src\examples\ejb20\relationships for an example application called Bands that uses EJBGen.

Invoking EJBGen

Use this command to run EJBGen on a bean source file:

javadoc -docletpath ejbgen.jar -doclet weblogic.tools.ejbgen.EJBGen (YourBean).java

If you do not have ejbgen.jar in your classpath, add the path to weblogic.jar as follows:

javadoc -docletpath <path_to_ejbgen.jar> ejbgen.jar -doclet weblogic.tools.ejbgen.EJBGen (YourBean).java

If you are invoking EJBGen for an EJB that has relationships with other EJBs, invoke the related EJBs by naming them, following your EJB, in the invocation, as follows:

javadoc -docletpath ejbgen.jar -doclet weblogic.tools.ejbgen.EJBGen (YourBean).java (RelatedBean).java

EJBGen Command Options

Table D-1 defines EJBGen command options.

Table D-1 EJBGen Command Options


 


 

Option

Default

Definition

-checkTags

N/A

If invoked with this option, EJBGen will not generate any classes but will search the classes supplied on the command line for tags that are not valid EJBGen tags.

-classpath

N/A

Class path.

-d [directory]


The directory under which all the files will be created.

-descriptorDir [directory]


The directory under which all the descriptor files will be created, relative to the output directory specified with the -d [directory] option.

-docTag tagName


If specified, EJBGen prints out the detailed documentation for this tag, including all the recognized attributes. Note that even though this option does not need any source file, you still need to specify an existing .java class on the command line, or Javadoc will emit an error message even though it recognized the flag.

-docTags


Print out all the tags known by EJBGen. Note that even though this option does not need any source file, you still need to specify an existing .java class on the command line, or Javadoc will emit an error message even though it recognized the flag.

-docTagsHtml


Same as -docTags, but generates an HTML document.

-ejbPrefix [string]

""

The prefix to use when generating the EJB class.

-ejbSuffix [string]

Bean or EJB

The suffix to use when generating the EJB class.

-ejbgenQuiet [boolean]

N/A

Make EJBGen less verbose.

-ejbgenVerbose [boolean]

N/A

Make EJBGen less verbose.

errorFile

N/A

The path of the file where errors will be redirected.

exitOnError [boolean]

N/A

EJBGen should exit in case of an error.

-homeBaseClass [string (className)]

N/A

The base class for home remote interfaces.

-experimental [boolean]

N/A

Enable experimental features.


-extractTemplates [directory]

N/A

The directory where to extract the templates.

-forceGeneration [boolean]

N/A

Force the generation of all files regardless of time stamps.

-homeBaseClass [string (className)]

N/A

The base class for home remote interfaces.

-ignorePackage


If this flag is set, EJBGen ignores the package name of the Java files it generates and creates those in the output directory as specified by the -d flag (or in the current directory if no -d was specified).

-jndiPrefix [string]

""

The prefix to use for @remote-jndi-name and @local-jndi-name

-jndiSuffix [string]

""

The suffix to use for @remote-jndi-name and @local-jndi-name

-localBaseClass [string (className)]

N/A

The base class for local interfaces.

localHomeBaseClass [className]

N/A

The base class for local home interfaces


-localHomePrefix [string]

""

The prefix to use when generating the local EJB class.

-localHomeSuffix [string]

LocalHome

The suffix to use when generating the local EJB class.

-localPrefix [string]

""

The prefix to use when generating the local EJB class.

-localSuffix [string] (


The suffix to use when generating the local EJB class.

-noImports [boolean]

false

Disable propagation of java imports to generated classes.

-noLocalInterfaces


If specified, local interfaces are not generated.

-noRedirection noRedirection ejbgen.noRedirection [boolean]

N/A

Cancel all redirection performed by EJBGen

-noRemoteInterfaces [boolean]


If specified, remote interfaces are not generated.

-noticeFile [file]

N/A

The path of the file where notices will be redirected.

-noValueClasses [boolean]

N/A

If specified, value classes will not be generated.

-pfd1

N/A

If this flag is set, EJBGen will generate deployment descriptors compatible with the Public Final Draft 1 of the EJB 2.0 specification. You should use this flag if you are using any version anterior to Weblogic 6.1.

-pfd2

N/A

If this flag is set, EJBGen will generate deployment descriptors compatible with the Public Final Draft 2 of the EJB 2.0 specification. You should use this flag if you are using any version anterior to Weblogic 6.1.

-primaryKeyBaseClass [string (class name)]

N/A

The base class for generated primary keys.

-printDiagnostic [boolean]

N/A

Prints a diagnostic of all the tags found by EJBGen

-printTags [boolean]

N/A

Display all the tags recognized by EJBGen

-propertyFile [fileName]


The name of a property file that EJBGen reads to define substitution variables. See Using Property Files with EJBGen.

-remoteBaseClass [string (className)]

N/A

The base class for remote interfaces.

-remoteHomePrefix [string]

""

The prefix to use when generating the remote EJB home class.

-remoteHomeSuffix [string]


The suffix to use when generating the remote EJB home class.

-remotePrefix [string]

""

The prefix to use when generating the remote EJB class.

-remoteSuffix [string]

""

The suffix to use when generating the remote EJB class.

source [version number]

1.3

Version of the JDK to use.

-sourcepath [directory]

N/A

Source path.

-templateDir [directory]

N/A

The directory where the templates are stored.

-toStringForPrimitivesOnly


If specified, the toString() methods of value objects only display container-managed persistence fields that are primitives. This flag fixes the problem of circular references between value objects (AValue.toString() invoking BValue.toString() invoking AValue.toString(), etcetera).

-valueBaseClass [string (class name)]

N/A

The suffix to use when generating the value object class.

-valueObjectPrefix [string]

N/A

The prefix to use when generating the value object class.

-valueObjectSuffix [string]

N/A

The suffix to use when generating the value object class.

-valuePackage [string (package name)]

N/A

Package the value classes belong to.

verbose [boolean]

false

Display more information.

-wls6 [boolean]

N/A

Use this flag to specify that EJBGen generate WebLogic Server 7.0 deployment descriptors.

-wls7 [boolean]

N/A

Use this flag to specify that EJBGen generate WebLogic Server 7.0 deployment descriptors.

-wls71 [boolean]

N/A

Use this flag to specify that EJBGen generate WebLogic Server 7.1 deployment descriptors.

-wls81 [boolean]

N/A

Use this flag to specify that EJBGen generate WebLogic Server 8.1 deployment descriptors.

-wls9 [boolean]

N/A

Use this flag to specify that EJBGen generate WebLogic Server 9.0 deployment descriptors.

-workshopDocTags [boolean]

N/A

Display the help in Workshop HTML format.

-xmlEncoding [string]

N/A

The encoding to use when generating XML files (default: UTF-8).


 

Javadoc Warnings with Uncompiled Value Type Classes

If an EJBGen class contains value types (e.g., parameter values, return values) that are Java classes that have not been compiled, then Javadoc will output what appear to be javac compilation errors, as in Listing 8-6:

Listing 8-6 Sample Javadoc Output When Value Type Classes Are Uncompiled

[javadoc]
C:\toddk\dev\issues\cr100528\src\test\po\PurchaseOrderBean.java:29: cannot resolve symbol [javadoc] symbol : class PurchaseOrder [javadoc] location: class test.po.PurchaseOrderBean [javadoc] public boolean submitPO(PurchaseOrder po) throws SubmitException {
[javadoc]
[javadoc] C:\toddk\dev\issues\cr100528\src\test\po\PurchaseOrderBean.java:29: cannot resolve symbol [javadoc] symbol : class SubmitException [javadoc] location: class test.po.PurchaseOrderBean [javadoc] public boolean submitPO(PurchaseOrder po) throws SubmitException {

These are Javadoc warnings, not errors. Because the error messages resemble javac compiler errors, it is easy to interpret them incorrectly as errors. Javadoc returns with an exit status that indicates success; therefore the Ant EJBGen task does not cause the build to fail.

Using Key EJBGen Features

These sections describe key EJBGen features and how to use them:

Controlling the Files EJBGen Generates

By default, EJBGen generates the following files:

You can selectively disable the generation of these files by using the @ejbgen:file-generation tag. This can be done on a per-bean basis. The following code sample suppresses value class generation:

/**
*   @ejbgen:file-generation
*   value-class = False
*/

Note: The -noValueClasses, -noRemoteInterfaces or -noLocalInterfaces, these command-line options override any tag found on the beans.

Using Property Files with EJBGen

EJBGen can gather information for generation from property files, as discussed in this section.

Use the -propertyFile option to tell EJBGen to parse a properties file. Listing 8-7 illustrates a sample property file.

Listing 8-7 Sample EJBGen Property File

# property-file
#
remote-jndi-name = Account

Use the following syntax to invoke EJBGen with the -propertyFile option:

javadoc -docletpath ejbgen.jar -doclet EJBGen -propertyFile property-file AccountBean.java

EJBGen recognizes two kinds of variables in a properties file: user variables and predefined variables.

Using User Variables

EJBGen tags can use variables instead of strings. These variables must be enclosed with "${" and "}", as in Listing 8-8.

Listing 8-8 User Variables in Place of Strings

@ejbgen:jndi-name
remote = ${remote-jndi-name}

Variables can be used anywhere after an EJBGen tag, so they can contain whole tag definitions, as in Listing 8-9.

Listing 8-9 User Variables as a Whole Tag Definition

@ejbgen:jndi-name
  ${jndi-name-tag}
#
#
# property-file
#
jndi-name-tag = remote = RemoteAccount local = LocalAccount

Using Predefined Variables

EJBGen recognizes a number of predefined variables. These variables are not supposed to be used in tags but EJBGen will use them at various places depending on their role. Here is the list of recognized variables:

You can make these variables more specific by prefixing them with an EJBName. For example, consider the following property file:

#
# property-file
#
Account.home.baseClass = BaseAccountHome
home.baseClass = BaseHome
value.package = value
containerManaged.value.package=valuePackageForContainerManaged

All homes generated by EJBGen extend the class BaseHome except the home of EJB "Account", which extends BaseAccountHome.

Surround Attributes that Contain Spaces With Double Quotes

When you specify an attribute that contains spaces, surround the attribute value with double quotes. For example:

group-names = "group1, group2"

EJBGen Supports Tag Inheritance

One of the main features in EJBGen 2.0 is tag inheritance. You inherit EJBGen annotations the same way you do it in Java. For example, assume that you have an EJB named AccountEJB with a base class BaseAccount, as in Listing 8-10:

Listing 8-10 Tag Inheritance

/**
*   @ejbgen:jndi-name
*    remote="BaseRemote"
*/
public class BaseAccount implements EntityBean {
// ...
}

Now, define your EJB class:

/**
*   @ejbgen:entity
*    ejb-name = containerManaged
*    table-name = ejbAccounts
*    data-source-name = examples-dataSource-demoPool
*   
   Note that we inherit the JNDI name defined in BaseAccount
*/
public class AccountEJB extends BaseAccount {
// ...

EJBGen Supports Attribute Inheritance

You can also inherit attributes. This is a very powerful feature with a lot of potential uses. For example, you could define a setting common to all your EJB's, such as max-beans-in-cache, as in Listing 8-11.

Listing 8-11 Attribute Inheritance

\


 
/**
*   @ejbgen:entity
*    max-beans-in-cache = 300
*/
public class BaseAccount implements EntityBean {
// ...
}

Then, you define your entity bean as follows:

/**
*    @ejbgen:entity
*    ejb-name = containerManaged
*    table-name = ejbAccounts
*    data-source-name = examples-dataSource-demoPool
*    
*    
// automatically inherit the attribute max-beans-in-cache = 300
*/
public class AccountEJB extends BaseAccount {
// ...

Of course, you still have the ability to modify the inherited value. For example, for a specific bean, you could change the default value of max-beans-in-cache from 300 to 400:

/**
*   @ejbgen:entity
*    ejb-name = containerManaged
*    table-name = ejbAccounts
*    data-source-name = examples-dataSource-demoPool
*    max-beans-in-cache = 400
*    
*    
// the above setting overrides the one defined in the base class
*/
public class AccountEJB extends BaseAccount {
// ...

 


Examples of EJBGen Tag Usage

These sections contain example source code annotated with EJBGen tags.

A Sample Bean File Annotated with EJBGen Tags

This example shows an CMP EJB 2.0 entity bean file with annotations that EJBGen can use to generate the remote and home interfaces and the deployment descriptor files. AccountBean.java is the main bean class.

/**
*   @ejbgen:entity
*    ejb-name = AccountEJB-OneToMany
*    data-source-name = examples-dataSource-demoPool
*    table-name = Accounts
*    prim-key-class = java.lang.String
*
*   @ejbgen:jndi-name
*    local = one2many.AccountHome
*    
*   @ejbgen:finder
*    signature = "Account findAccount(double balanceEqual)"
*    ejb-ql = "WHERE balance = ?1"
*
*   @ejbgen:finder
*    signature = "Collection findBigAccounts(double balanceGreaterThan)"
*    ejb-ql = "WHERE balance > ?1"
*
*   @ejbgen:relation
*    name = Customer-Account
*    target-ejb = CustomerEJB-OneToMany
*    multiplicity = many
*    cmr-field = customer
*
*/
abstract public class AccountBean implements EntityBean {

/**
*   @ejbgen:cmp-field column = acct_id
*    @ejbgen:primkey-field
*    @ejbgen:remote-method transaction-attribute = Required
*/
   abstract public String getAccountId();
   abstract public void setAccountId(String val);
// ....
}

This example illustrates the two types of EJBGen tags: class tags and method tags, depending on where you can use them.

After completing the file, invoke EJBGen through the following Javadoc command:

javadoc -docletpath weblogic.jar -doclet weblogic.tools.ejbgen.EJBGen AccountBean.java

The Javadoc command generates the following files:

EJBGen Tag Reference defines the EJBGen tags you can use to annotate your bean class file.

Mapping an Entity Bean to Several Tables with EJBGen

By default, entity beans are mapped to one table, with the attribute table-name on the tag @ejbgen:entity. If you want to map your entity bean to more than one table, you can use the table-name attribute on individual @ejbgen:cmp-fields. All the container-managed persistence fields that do not have a table-name attribute will use the table specified on @ejbgen:entity (which can therefore be considered as the "default" table).

If you want to map an entity bean to several tables, you need to specify a comma-separated list of tables in the table-name attribute (and also on a column). For example:

Make sure that the number of tables matches the number of columns, and that the columns exist in the corresponding table.

Specifying Relationship Caching with EJBGen Tags

You can specify relationship caching elements with the @ejbgen:relationship-caching tag. This XML element can be nested (recursive). In other words, you can specify a tree representing all the relationship elements that you want to see cached.

In order to support this tree structure, @ejbgen:relationship-caching has two attributes, id and parent-id. These attributes do not correspond to any XML, they simply allow you to specify your tree structure.

For example, if a caching-element A needs to have two children elements B and C, all you need to specify is an id for A (say "root0") and a parent-id for B and C equal to that name.

Listing 8-12 illustrates specifying relationship caching.

Listing 8-12 Specifying Relationship Caching

*   @ejbgen:relationship-caching-element
*    caching-name = cacheMoreBeans
*    cmr-field = employee
*    group-name = emp-group
*    id = A
*    
*   @ejbgen:relationship-caching-element
*    caching-name = cacheMoreBeans
*    cmr-field = employee_ssn
*    group-name = emp-group
*    parent-id = A
*    
*   @ejbgen:relationship-caching-element
*   caching-name = cacheMoreBeans
*   cmr-field = employee_zip
*   group-name = emp-group
*   * parent-id = A

Specifying Relationships with EJBGen Tags

Unidirectional relationships are achieved by specifying only the first two parameters of the relation tag (no CMR_field, no joint table).

Many-to-many relationships must specify an extra table (parameter "joint table") which must contain at least two columns. The names of these columns must match the names of the columns containing the foreign keys of the two beans being joined.

Upgrading Relationships to Use Local Interfaces

If you have EJB's based on a version of the EJB 2.0 specification that predates PFD2, you will need to update them. As of PFD2, relationships must be based on local interfaces, not remote ones. Here are the steps you need to take up upgrade your EJB's:

  1. Add a JNDI name for your local home interface:
  2. @ejbgen:jndi-name
    remote = AccountHome
    local = AccountLocalHome

  3. Add @ejbgen:local-method tags to any method you want to see appear on the local home interface. A method can have both @ejbgen:local-method and @ejbgen:remote-method.
  4. Change the return type of your container-managed relationship (CMP) accessing methods to that of the local EJB object (this only applies to single-valued CMR fields since multi-valued CMR fields are collections. Keep in mind that these collections contain Local EJB objects):
  5. /**
    *   @ejbgen:cmr-field
    *   
    *   @ejbgen:remote-method
    *   @ejbgen:local-method
    */
    abstract public LocalCustomer getCustomer();

 


EJBGen Tag Reference

This section provides a complete reference for EJBGen tags you can use to annotate your bean class file.

@ejbgen:automatic-key-generation

Where: Class

Applicable to: Entity bean

Attribute

Description

Required

cache-size

The size of the key cache.

Yes

name

The name of the generator.

Yes

type

The type of the generator.

Yes


 

@ejbgen:cmp-field

Where: Method

Applicable to: Entity bean

Attribute

Description

Required

column

The column where this CMP field will be mapped. See Mapping an Entity Bean to Several Tables with EJBGen.

Yes

column-type

(OracleClob|OracleBlob) The type of this column.

No

exclude-from-value-object

(True|False) If True, this field will not be generated in the value object.

No

group-names

Comma-delimited names of the groups this field belongs to. Surround the list of group names with double quotes.

No

ordering-number (0..n)

The number where this field must appear in signatures and constructors. For this ordering to work, all cmr and cmp fields must set this attribute to a distinct numeric value.

No

primkey-field

(True|False) Whether this field is part of the compound primary key.

No

read-only-in-value-object

(True|False) If True, only the getter will be generated for this field in the value object.

No

table-name

The table(s) where this field should be mapped. Mapping an Entity Bean to Several Tables with EJBGen.

No


 

@ejbgen:cmr-field

Where:Method

Applicable to: Entity bean

Attribute

Description

Required

exclude-from-value-object

(True|False) If True, this field will not be generated in the value object.

No

group-names

Comma-delimited names of the groups this field belongs to. Surround the list of group names with double quotes.

No

ordering-number (0..n)

The number where this field must appear in signatures and constructors. For this ordering to work, all cmr and cmp fields must have this attribute to a distinct numeric value.

No

read-only-in-value-object

(True|False) If True, only the getter will be generated for this field in the value object.

No


 

@ejbgen:compatibility

Where:Class

Applicable to: All

Attribute

Description

Required

serialize-byte-array-to-oracle-blob

(True|False) Whether a cmp-field of type byte[] mapped to a OracleBlob should be serialized.

No


 

@ejbgen:create-default-rdbms-tables

Where: Class

Applicable to: Entity bean

Attribute

Description

Required

value

(CreateOnly|Disabled|DropAndCreate|DropAndCreateAlways|AlterOrCreate)

No


 

@ejbgen:ejb-client-jar

Where: Class

Applicable to: All bean types

Attribute

Description

Required

file-name

The name of the client JAR to generate. If more than one EJB has this tag, only one of the specified JAR files is included in the deployment descriptor.

Yes


 

@ejbgen:ejb-interface

Where: Class

Applicable to: All bean types

Attribute

Description

Required

ejb-type

(javax.ejb.MessageDrivenBean|javax.ejb.EntityBean|javax.ejb.SessionBean) Specifies the type of this EJB. This tag is not normally used.

Yes


 

@ejbgen:ejb-local-ref

Where: Class

Applicable to: Session and entity beans

Attribute

Description

Required

home

Local class of the bean.

No

id

The identity of this tag (used for tag inheritance only).

No

jndi-name

The JNDI name of the reference.

No

link

Link to the bean.

No

local

Home class of the bean.

No

name

Name of the reference.

No

type

(Entity | Session)

No


 

@ejbgen:ejb-ref

Where: Class

Applicable to: All bean types

Attribute

Description

Required

home

Remote class of the bean.

No

id

The identity of this tag (used for tag inheritance only).

No

jndi-name

The JNDI name of the reference.

No

link

Link of the bean.

No

name

Name of the reference.

No

remote

Home class of the bean.

No

type

(Entity|Session)

No


 

@ejbgen:entity

Where: Class

Applicable to: Entity beans

Attribute

Description

Required

ejb-name

The name of this entity bean.

Yes

prim-key-class

null

Yes

abstract-schema-name

The abstract schema name for this EJB. If not specified, the ejb-name value will be used.

No

cache-between-transactions

(True|False) Whether to cache the persistent data of an entity bean across (between) transactions.

No

check-exists-on-method

(True|False) Whether the container checks for the existence of a bean for each method call.

No

concurrency-strategy

(Optimistic|ReadOnly|Exclusive|Database) Defines the concurrency strategy for this bean.

No

data-source-name

The name of the DataSource (as it was declared in your config.xml file).

No

database-type

The type of the database.


db-is-shared

(True|False)

No

default-dbms-tables-ddl

Specifies the DDL file name.

No

default-transaction

The transaction attribute to be applied to all methods that do not have a more specific transaction attribute setting.

No

delay-database-insert-until

(ejbCreate|ejbPostCreate)

No

delay-updates-until-end-of-tx

(True|False) Determines whether updates will be sent after the transaction has been committed.

No

dispatch-policy

The JMS dispatch policy queue for this bean

No

enable-batch-operations

(True|False) Determines whether to perform batch operations.

No

enable-call-by-reference

(True|False) Whether the container will call this EJB by reference

No

enable-dynamic-queries

(True|False) Whether dynamic queries are enabled.

No

finders-load-bean

(True|False) If this is set to True, the beans will immediately be loaded into the cache by the finder.

No

home-call-router-class-name

Class to be used for routing home method calls.

No

home-is-clusterable

(True|False) Whether this bean can be deployed from multiple servers in a cluster.

No

home-load-algorithm

(RoundRobin|Random|WeightBased) The algorithm to use for load-balancing between replicas of this home.

No

idle-timeout-seconds

Maximum duration an EJB should stay in the cache.

No

initial-beans-in-free-pool

Specifies the initial number of beans in the free pool.

No

instance-lock-order

(AccessOrder|ValueOrder) The locking order for this Entity bean.

No

invalidation-target

The ejb-name of a read-only entity bean that should be invalidated when this container-managed persistence entity EJB has been modified.

No

lock-order

Sets the database locking order of this bean when a transaction involves multiple beans.

No

max-beans-in-cache

The maximum number of beans in the cache.

No

max-beans-in-free-pool

The maximum number of beans in the free pool.

No

optimistic-column

The column that holds the timestamp for optimistic concurrency

No

persistence-type

(CMP|BMP) Whether this bean's persistence is container managed or bean-managed.

No

prim-key-class-nogen

(True|False). If this keyword is specified, EJBGen does not generate the primary key class—it is assumed that you are providing it yourself.

No

read-timeout-seconds

The number of seconds between each ejbLoad() call on a read-only entity bean.

No

reentrant

(True|False)

No

run-as

Specifies the role-name for this EJB.

No

run-as-identity-principal

The name of the principal in case the role maps to several principals.

Note: run-as-identity-principal was deprecated in WebLogic Server 8.1.

No

table-name

The Java class of the primary key. In case of a compound primary key, this class is generated by EJBGen.

No

trans-timeout-seconds

The transaction timeout, in seconds.

No

use-caller-identity

(True|False) Whether this EJB uses caller's identity.

No

use-select-for-update

(True|False) Causes SELECT ... FOR UPDATE to be used whenever the bean is loaded from the database.

No

validate-db-schema-with

(MetaData|TableQuery) The method used to validate the tables created by the EJB container.

No

verify-columns

(Read|Modified|Version|Timestamp) How optimistic concurrency verifies that the columns modified during the transactions have not been modified.

No

verify-rows

(Read|Modified) How optimistic concurrency verifies that the rows modified during the transactions have not been modified.

No


 

@ejbgen:entity-cache-ref

Where: Class

Applicable to: Entity beans

Attribute

Description

Required

cache-between-transactions

(True|False) Whether to cache the persistent data of an entity bean across (between) transactions.

No

concurrency-strategy

(Optimistic|ReadOnly|Exclusive|Database) Defines the concurrency strategy for this bean.

No

estimated-bean-size

The estimated average size of the instances of an entity bean in bytes.

No

name

The name of the cache.

No


 

@ejbgen:env-entry

Where:Class

Applicable to: All bean types

Attribute

Description

Required

name

The name of this environment entry.

Yes

type

The Java type for this environment entry (must be fully qualified, even if java.lang).

Yes

value

The value for this environment entry.

Yes


 

@ejbgen:file-generation

Where:Class

Applicable to: All bean types

Attribute

Description

Required

local-class

(True|False) Whether to generate the local interface for this EJB.

No

local-class-name

The name of the local class to be generated.

No

local-home

(True|False) Whether to generate the local home interface for this EJB.

No

local-home-name

The name of the local home class to be generated.

No

local-home-package

The package for the local home interface.

No

local-package

The package for the local interface.

No

pk-class

(True|False) Whether to generate the primary key class for this EJB.

No

remote-class

(True|False) Whether to generate the remote interface for this EJB.

No

remote-class-name

The name of the remote class to be generated.


remote-home

(True|False) Whether to generate the remote home interface for this EJB.

No

remote-home-name

The name of the remote home class to be generated.

No

remote-home-package

The package for the remote home interface.

No

remote package

The package for the remote interface.

No

value-class

(True|False) Whether to generate the value class for this EJB.

No

value-class-name

The name of the value class to be generated.

No


 

@ejbgen:finder

Where: Class

Applicable to: Entity beans

Attribute

Description

Required

caching-name

The name of an eager relationship caching.

No

comment

A comment that will be reproduced above the generated finder Java method.

No

ejb-ql

The EJB QL request as it will appear in the deployment descriptor.

No

generate-on

(Local|Remote) On which home this finder will be generated (if unspecified, both)

No

group-name

Name of the group for the WebLogic query.

No

include-updates

(True|False) Whether updates made during the current transaction must be reflected in the result of a query.

No

isolation-level

The type of transaction isolation for this method.

No

max-elements

The maximum number of elements that should be returned by a multi-valued query.

No

signature

It must match exactly the signature as you want it generated on the Home class. EJBGen adds the conformant exceptions, but you must make sure that you specify the fully qualified type of each parameter, even if it belongs to java.lang.

No

sql-select-distinct

(True|False) Whether the generated SQL 'SELECT' contains a 'DISTINCT' qualifier.

No

transaction-attribute

(NotSupported|Supports|Required|RequiresNew|Mandatory|Never) The transaction attribute for this local method. If not specified, the default transaction attribute will be used. Methods with this tag will are generated on the Local class.

No

weblogic-ejb-ql

The Weblogic EJB Query Language (QL) request as it will appear in the deployment descriptor. Note: if this request is needed, you need to enclose both EJB QL and Weblogic EJB QL within double quotes.

No


 

@ejbgen:foreign-jms-provider

Where: Class

Applicable to: Message-driven beans

Attribute

Description

Required

connection-factory-jndi-name

The JNDI name for the connection factory.

No

initial-context-factory

The initial JNDI context factory.

No

provider-url

The URL of the foreign JMS provider.

Yes


 


 

@ejbgen:jar-settings

Where: Class

Applicable to: All bean types

Attribute

Description

Required

create-tables

Whether to create tables.

No

disable-warning

A comma-separated line of warnings to disable when running ejbc.

No


ejb-client-jar

Specifies the name of the client JAR to be generated. If multiple EJBs have this tag, only one of the specified JAR files will be included in the deployment descriptor.

No


enable-bean-class-redeploy

(True|False) Determines whether this EJB can be redeployed without redeploying the entire module.

No



 

@ejbgen:jndi-name

Where: Class

Applicable to: All bean types

Attribute

Description

Required

local

The local JNDI name of this EJB. It not specified, no local interfaces is generated.

No

remote

The remote JNDI name of this EJB. It not specified, no remote interfaces is generated.

No


 

@ejbgen:local-home-method

Where: Method

Applicable to: Entity and Session beans

Attribute

Description

Required

is-idempotent

(True|False) Specifies whether this method is idempotent.

No

isolation-level

(TransactionSerializable|TransactionReadCommitted|TransactionReadUncommitted|TransactionRepeatableRead) Specifies the type of transaction isolation for this method.

No

ordering-number

(0..n) Specifies the number where this method must appear in the generated class. No


roles

Comma-delimited list of roles that are allowed to invoke this method.

No

transaction-attribute

The transaction attribute for this local method. If not specified, the default transaction attribute will be used. Methods with this tag are generated on the Local class.

No


 

@ejbgen:local-method

Where: Method

Applicable to: Entity and Session beans

Attribute

Description

Required

is-idempotent

(True|False) Whether this method is idempotent.

No

isolation-level

The type of transaction isolation for this method.

No

ordering-number

(0..n) The number where this method must appear in the generated class.

No

roles

Comma-delimited list of roles that are allowed to invoke this method.

No

transaction-attribute

(NotSupported|Supports|Required|RequiresNew|Mandatory|Never) The transaction attribute for this local method. If not specified, the default transaction attribute will be used. Methods with this tag will be generated on the Local class.

No


 

@ejbgen:message-driven

Where: Class

Applicable to: Message-Driven beans

Attribute

Description

Required

acknowledge-mode

(auto-acknowledge|dups-ok-acknowledge) The acknowledgement mode.

No

clients-on-same-server

(True|False) Specifies whether the clients are collocated with the EJB on the same server.

No

create-as-principal-name

Names the principal to be used when ejbCreate would otherwise run with an anonymous principal.

No

default-transaction

The transaction attribute to be applied to all methods that do not have a more specific transaction attribute setting.

No

destination-jndi-name

The JNDI name of the destination.

Yes

destination-type

(javax.jms.Queue|javax.jms.Topic)The JMS destination type.

Yes

dispatch-policy

Specifies the dispatch policy queue for this bean.

No

durable

(True|False) If the destination-type is Topic, setting this attribute to True will make the subscription durable.

No

ejb-name

The name of this message-driven bean.

Yes

enable-call-by-reference

(True|False) Whether the container will call this EJB by reference

No

initial-beans-in-free-pool

The initial number of beans in the free pool.

No

jms-client-id

The client id of this EJB.

No

jms-polling-interval-seconds

The number of seconds between each attempt to reconnect to the JMS destination.

No

max-beans-in-free-pool

The maximum number of beans in the free pool.

No

message-selector

The JMS message selector.

No

passivate-as-principal-name

Names the principal to be used when ejbPassivate would otherwise run with an anonymous principal.

No

remove-as-principal-name

Names the principal to be used when ejbRemove would otherwise run with an anonymous principal.

No

run-as

Specifies the role-name for this EJB.

No

run-as-identity-principal

The name of the principal in case the role maps to several principals.

Note: This attribute was deprecated in WebLogic Server 8.1

No

transaction-type

(Bean|Container) Specifies where the transactions for this EJB are managed.

No

trans-timeout-seconds

The transaction timeout (in seconds).

No

use-caller-identity

(True|False) Whether this EJB uses caller's identity.

No


 

@ejbgen:method-isolation-level-pattern

Where: Class

Applicable to: All beans

Attribute

Description

Required

id

The identity of this tag (used for tag inheritance only).

No

isolation-level

The isolation level for the methods specified in the pattern tag.

Yes

pattern

The pattern that matches all methods that will receive this isolation level (for example, "*").

Yes


 

@ejbgen:method-permission-pattern

Where: Class

Applicable to: All beans

Attribute

Description

Required

id

The identity of this tag (used for tag inheritance only).

No

interface

(Home|Remote|LocalHome|Local) The interface where this permission pattern applies.

No

itf

(Home|Remote|LocalHome|Local) Specifies the interface to which this permission pattern applies.

No

pattern

The pattern that matches all methods that will receive this isolation level (for example, "*").

Yes

roles

Comma-delimited list of roles for the methods specified in the pattern tag.

Yes


 

@ejbgen:relation

Where: Class

Applicable to: Entity beans

Attribute

Description

Required

cascade-delete

(True|False)

No

cmr-field

The cmr field where this relationship will be kept. This field is optional. If it not present, the relationship is unidirectional. If it is present, the attribute fk-column must be specified as well.

No

db-cascade-delete

(True|False) Whether a cascade delete will use the built-in cascade delete facilities of the underlying DBMS.

No

fk-column

Only needed in a relationship having at least one One side. In that case, the non-One side EJB must declare a column that it will use to store the primary key of its counterpart.

No

foreign-key-table

The name of a DBMS table that contains a foreign-key.

No

join-table

Only needed in a many-to-many relationship. It must be the name of an existing table that will be used to hold the joint table containing the relationships. In case you are using a compound primary key, you need to specify a set of corresponding foreign keys separated by a comma.

No

multiplicity

(One|Many)

Yes

name

The name of the relationship. Make sure you use the same name on both ends of a relationship for the roles to be generated properly (note that this constraint applies to unidirectional as well).

Yes

primary-key-table

The name of a DBMS table that contains a primary-key.

No

role-name

The name of this role (such as ParentHasChildren). If no role name is given, EJBGen will generate one for you. Note that you have to specify a role-name if you are going to inherit relations.

No

target-ejb

The EJB name of the target of this relationship.

Yes


 

@ejbgen:relationship-caching-element

Where: Method

Applicable to: Entity beans

Attribute

Description

Required

caching-name

The name of an eager relationship caching.

Yes

cmr-field

A comma-delimited list of CMR field names.

Yes

group-name

The name of the group to be loaded for the CMR field.

No

id

An id that allows a child to use this element as a parent. See Specifying Relationship Caching with EJBGen Tags.

No

parent-id

The parent id of this element.

No


 

@ejbgen:remote-home-method

Where: Method

Applicable to: Entity and Session beans

Attribute

Description

Required

is-idempotent

(True|False) Specifies whether this method is idempotent. No

No

isolation-level

(TransactionSerializable|TransactionReadCommitted|TransactionReadUncommitted|TransactionRepeatableRead) Specifies the type of transaction isolation for this method.

No

ordering-number

(0..n) Specifies the number where this method must appear in the generated class

No

roles

Comma-delimited list of roles that are allowed to invoke this method.

No

transaction-attribute

The transaction attribute for this remote method. If not specified, the default transaction attribute will be used. Methods with this tag will be generated on the Remote class.

No


 

@ejbgen:remote-method

Where: Method

Applicable to: Entity and Session beans

Attribute

Description

Required

is-idempotent

(True|False) Whether this method is idempotent.

No

isolation-level

The type of transaction isolation for this method.

No

ordering-number

(0..n) The number where this method must appear in the generated class.

No

roles

Comma-delimited list of roles that are allowed to invoke this method.

No

transaction-attribute

(NotSupported|Supports|Required|RequiresNew|Mandatory|Never) The transaction attribute for this local method. If not specified, the default transaction attribute will be used. Methods with this tag will be generated on the Local class.

No


 

@ejbgen:resource-env-ref

Where: Class

Applicable to: All bean types

Attribute

Description

Required

id

The identity of this tag (used for tag inheritance only).

No

jndi-name

JNDI name of the resource.

No

name

Name of the resource environment reference.

Yes

type

Type of the environment resource references (e.g. javax.jms.Queue).

Yes


 

@ejbgen:resource-ref

Where: Class

Applicable to: All bean types

l

Attribute

Description

Required

auth

(Application|Container)

Yes

id

The identity of this tag (used for tag inheritance only).

No

jndi-name

JNDI name of the resource.

Yes

name

Name of the resource.

Yes

sharing-scope

(Shareable|Unshareable)

No

type

Type of the resource (e.g. javax.sql.DataSource).

Yes


 

@ejbgen:role-mapping

Where: Class

Applicable to: All bean types

Note:

Attribute

Description

Required

externally-defined

(True|False) True if this role is defined externally.

No

global-role

(True|False) True if this role is global.

Note: global-role was deprecated in WebLogic Server 7.0

No

id

The identity of this tag (used for tag inheritance only).

No

principals

The names of the principals in this role (separated by commas).

No

role-name

The name of the role.

Yes


 

@ejbgen:security-role-ref

Where: Method

Applicable to: Entity and session beans

Attribute

Description

Required

id

The identity of this tag (used for tag inheritance only).

No

role-link

A reference to a defined security role.

No

role-name

The name of the security role.

Yes


 

@ejbgen:select

Where: Method

Applicable to: Entity beans

Attribute

Description

Required

caching-name

The name of an eager relationship caching.

No

ejb-ql

The EJB-QL defining this select method.

The method name must start with ejbSelect.

Yes

group-name

Name of the group for the query.

No

include-updates

(True|False) Whether updates made during the current transaction must be reflected in the result of a query.

No

max-elements

The maximum number of elements that should be returned by a multi-valued query.

No

ordering-number

(0..n) The number where this method must appear in the generated class.

No

result-type-mapping

(Remote|Local) Whether the returned objects are mapped to EJBLocalObject or EJBObject.

No

sql-select-distinct

(True|False) Determines whether the generated SQL SELECT will contain a DISTINCT qualifier.

No

weblogic-ejb-ql

The Weblogic EJB QL request as it will appear in the deployment descriptor.

Note: If this request is needed, you need to enclose both EJB QL and Weblogic EJB QL within double quotes.

No


 

@ejbgen:session

Where: Class

Applicable to: Session beans

Attribute

Description

Required

allow-concurrent-calls

(True|False) Whether to allow concurrent calls on that EJB.

No

allow-remove-during-transaction

(True|False) Specifies whether remove() can be invoked during a transaction.

No

bean-load-algorithm

The algorithm to use for load-balancing between replicas of this bean.

No

cache-type

(NRU|LRU) Specifies the type of the cache for this stateful Session bean.

No

call-router-class-name

Class name to be used for routing home method calls.

No

clients-on-same-server

(True|False) Specifies whether the clients are collocated with the EJB on the same server.

No

create-as-principal-name

Names the principal to be used when ejbCreate would otherwise run with an anonymous principal.

No

default-transaction

The transaction attribute to be applied to all methods that do not have a more specific transaction attribute setting.

No

dispatch-policy

The JMS dispatch policy queue for this bean

No

ejb-name

The name of this session bean.

Yes

enable-call-by-reference

(True|False) Whether the container will call this EJB by reference

No

home-call-router-class-name

Class to be used for routing home method calls.

No

home-is-clusterable

(True|False) Whether this bean can be deployed from multiple servers in a cluster.

No

home-load-algorithm

(RoundRobin|Random|WeightBased) The algorithm to use for load-balancing between replicas of this home.

No

idle-timeout-seconds

Maximum duration an EJB should stay in the cache.

No

initial-beans-in-free-pool

The initial number of beans in the free pool.

No

is-clusterable

(True|False) Whether this bean is clusterable

No

load-algorithm

(RoundRobin|Random|WeightBased) The name of the algorithm used to balance replicas of this home

No

max-beans-in-cache

The maximum number of beans in the cache.

No

max-beans-in-free-pool

The maximum number of beans in the free pool.

No

methods-are-idempotent

(True|False) Whether the methods for this stateless session bean are idempotent or not.

No

passivate-as-principal-name

Names the principal to be used when ejbPassivate would otherwise run with an anonymous principal.

No

persistent-store-dir

The directory in which to store the passivated beans.

No

remove-as-principal-name

Names the principal to be used when ejbRemove would otherwise run with an anonymous principal.

No

replication-type

(InMemory|None) How to replicate stateful session beans in a cluster.

No

run-as

Specifies the role-name for this EJB.

No

run-as-identity-principal

The name of the principal in case the role maps to several principals.

Note: Deprecated in WebLogic Server 8.1.

No

transaction-type

(Bean|Container) Whether transactions for this EJB are bean- managed or container-managed.

No

trans-timeout-seconds

The transaction timeout, in seconds.

No

type

(Stateless | Stateful) The type of the session bean. If this attribute is not specified, EJBGen guesses the right type by looking at the ejbCreate() methods on your class.

No

use-caller-identity

(True | False) Whether this EJB uses caller's identity.

No


 

@ejbgen:value-object

Where: Class

Applicable to: All bean types

Attribute

Description

Required

reference

(Local|Value) Specifies which objects the value object class should reference when accessing other EJB's.

Yes


 

 

Skip navigation bar  Back to Top Previous Next