BEA Logo BEA WebLogic Server Release 6.1

  BEA Home  |  Events  |  Solutions  |  Partners  |  Products  |  Services  |  Download  |  Developer Center  |  WebSUPPORT

 

  |  

  WebLogic Server Doc Home   |     Console Online Help   |   Previous Topic   |   Next Topic   |   Contents   |   Index   |   View as PDF

RDBMS Deployment Descriptors

 

 


weblogic-cmp-rdbms-jar.xml deployment descriptors

This section describes the 6.1 WebLogic Server-specific XML elements found in weblogic600-cmp-rdbms-jar.xml that are used to define the deployment descriptors in the WebLogic Server EJB container. These elements map to fields, of approximately the same name, in the WebLogic Server Administration Console Use these deployment descriptors for 2.0 EJBs.

automatic-key-generation

Range of values:

n/a

Default value:

n/a

Requirements:

Optional.

Parent elements:

weblogic-rdbms-bean

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The automatic-key-generation element specifies the use of the Sequence/Key Generation feature.

cmp-field

Range of values:

Valid name

Default value:

n/a

Requirements:

Field is case sensitive and must match the name of the field in the bean and must also have a cmp-entry entry in the ejb-jar.xml.

Parent elements:

weblogic-rdbms-bean
field-map
weblogic-rdbms-relation
field-group

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

This name specifies the mapped field in the bean instance which should be populated with information from the database.

cmr-field

Range of values:

Valid name

Default value:

n/a

Requirements:

The field referenced in cmr-field must have a matching cmr-field entry in the ejb-jar.xml.

Parent elements:

weblogic-rdbms-relation

field-group

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The cmr-field element specifies the name of a cmr-field.

column-map

Range of values:

n/a.

Default value:

n/a

Requirements:

The key-column element is not specified, if the foreign-key-column refers to a remote bean.

Parent elements:

weblogic-rdbms-bean
weblogic-relationship-role

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

This element represents the mapping of a foreign key column in one table in the database to a corresponding primary key. The two columns may or may not be in the same table. The tables to which the column belong are implicit from the context in which the column-map element appears in the deployment descriptor.

create-default-dbms-table

Range of values:

True | False.

Default value:

False

Requirements:

Use this element only for convenience during the development and prototyping phases. This is because the Table Schema in the DBMS CREATE statement used will be the container's best approximation of the definition. A production environment most likely, will require a more precise schema definition.

Parent elements:

weblogic-rdbms-jar

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The create-default-dbms-table element turns on or off a feature that automatically creates a default table based on the descriptions in the deployment files and the bean class. When set to False, this feature is turned off and table will not automatically be generated. When set to True, this feature is turned on and the table is automatically created. If TABLE CREATION fails, a Table Not Found error is thrown and the table must be created by hand.

data-source-name

Range of values:

Valid name of the data source used for all data base connectivity for this bean.

Default value:

n/a

Requirements:

Must be defined as a standard WebLogic Server JDBC data source for database connectivity.

Parent elements:

weblogic-rdbms-bean

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The data-source-name that specifies the JDBC data source name to be used for all database connectivity for this bean.

db-cascade-delete

Range of values:


Default value:

n/a

Requirements:

Only supported for Oracle database. Can only be specified for one-to-one or one-to-many relationships.

Parent elements:

weblogic-rdbms-bean
weblogic-relationship-role

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The db-cascade-delete element specifies whether the database cascade feature is turned on. If this element is not specified, WebLogic Server

dbms-column

Range of values:

Valid name

Default value:

n/a

Requirements:

dbms-column is case maintaining, although not all database are case sensitive.

Parent elements:

weblogic-rdbms-bean
field-map

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The name of the database column to which the field should be mapped.

dbms-column-type

Range of values:

Valid name

Default value:

n/a

Requirements:

Available for use with Oracle database only.

Parent elements:

weblogic-rdbms-bean
field-map

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The dbms-column-type element maps the current field to a Blob or Clob in an Oracle database. This element can be either OracleBlob or OracleCLob.

delay-database-insert-until

Range of values:


Default value:

ejbPostCreate

Requirements:

Database insert is delayed until after ejbPostCreate when a cmr-field is mapped to a foreign-key column that does not allow null values. In this case, the cmr-field must be set to a non-null value in ejbPostCreate before the bean is inserted into the database.

The cmr-fields may not be set during ejbCreate, before the primary key of the bean is known.

Parent elements:

weblogic-rdbms-bean

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The delay-database-insert-until element specifies the precise time when a new bean that uses RDBMS CMP is inserted into the database.

It is advisable to delay the database insert until after the ejbPostCreate method modifies the persistent fields of the bean. This can yield better performance by avoiding an unnecessary store operation.

For maximum flexibility, you should avoid creating related beans in your ejbPostCreate method. This may make delaying the database insert impossible if database constraints prevent related beans from referring to a bean that has not yet been created.

ejb-name

Range of values:

Valid name of an EJB.

Default value:

n/a

Requirements:

Must match the ejb-name of the cmp entity bean defined in the ejb-jar.xml.

Parent elements:

weblogic-rdbms-bean

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The name that specifies an EJB as defined in the ejb-cmp-rdbms.xml. This name must match the ejb-name of a cmp entity bean contained in the ejb-jar.xml.

field-group

Range of values:

Valid name

Default value:

A special group named default is used for finders and relationships that have no group specified.

Requirements:

The default group contains all of a bean's cmp-fields, but none of its cmr-fields.

Parent elements:

weblogic-rdbms-relation

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The field-group element represents a subset of the cmp and cmr-fields of a bean. Related fields in a bean can be put into groups that are faulted into memory together as a unit. A group can be associated with a finder or relationship, so that when a bean is loaded as the result of executing a finder or following a relationship, only the fields specified in the group are loaded.

A field may belong to multiple groups. In this case, the getXXX method for the field faults in the first group that contains the field.

field-map

Range of values:

Valid name

Default value:

n/a

Requirements:

Field mapped to the column in the database must correspond to a cmp field in the bean.

Parent elements:

weblogic-rdbms-bean

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The name of the mapped field for a particular column in a database that corresponds to a cmp field in the bean instance.

foreign-key-column

Range of values:

Valid name

Default value:

n/a

Requirements:

Must correspond to a column of a foreign key.

Parent elements:

weblogic-rdbms-bean
column-map

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The foreign-key-column element represents a column of a foreign key in the database.

generator-name

Range of values:

n/a

Default value:

n/a

Requirements:

Optional.

Parent elements:

weblogic-rdbms-bean
automatic-key-generation

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The generator-name element is used to specify the name of the generator.

For example;

generator-type

Range of values:

n/a

Default value:

n/a

Requirements:

Optional

Parent elements:

weblogic-rdbms-bean
automatic-key-generation

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The generator-type element specifies the key generation method to use. The options include:

group-name

Range of values:

Valid name

Default value:

n/a

Requirements:

n/a

Parent elements:

weblogic-rdbms-relation

field-group

weblogic-rdbms-bean

finder

finder-query

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The group-name element specifies the name of a field group.

include-updates

Range of values:

True | False

Default value:

False

Requirements:

The default value, which is False, provides the best performance.

Parent elements:

weblogic-rdbms-bean

weblogic-query

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The include-updates element specifies that updates made during the current transaction must be reflected in the result of a query. If this element is set to True, the container will flush all changes made by the current transaction to disk before executing the query.

key-cache-size

Range of values:

n/a

Default value:

n/a

Requirements:

Optional

Parent elements:

weblogic-rdbms-bean
automatic-key-generation

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The key-cache-size element specifies the optional size of the primary key cache available in the automatic primary key generation feature.

key-column

Range of values:

Valid name

Default value:

n/a

Requirements:

Must correspond to a column of a primary key.

Parent elements:

weblogic-rdbms-bean
column-map

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The key-column element represents a column of a primary key in the database.

max-elements

Range of values:

n/a

Default value:

n/a

Requirements:

n/a

Parent elements:

weblogic-rdbms-bean

weblogic-query

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

max-elements specifies the maximum number of elements that should be returned by a multi-valued query. This element is similar to the maxRows feature in JDBC.

method-name

Range of values:

n/a

Default value:

n/a

Requirements:

The `*' character may not be used as a wildcard.

Parent elements:

weblogic-rdbms-bean

query-method

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The method-name element specifies the name of a finder or ejbSelect method.

method-param

Range of values:

Valid name

Default value:

n/a

Requirements:

n/a

Parent elements:

weblogic-rdbms-bean

method-params

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The method-param element contains the fully qualified Java type name of a method parameter.

method-params

Range of values:

list of valid names

Default value:

n/a

Requirements:

n/a

Parent elements:

weblogic-rdbms-bean

query-method

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The method-params element contains an ordered list of the fully-qualified Java type names of the method parameters.

query-method

Range of values:

n/a

Default value:

n/a

Requirements:

n/a

Parent elements:

weblogic-rdbms-bean

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The query-method element specifies the method that is associated with a weblogic-query. It also uses the same format as the ejb-jar.xml descriptor.

relation-name

Range of values:

Valid name

Default value:

n/a

Requirements:

Must match the ejb-relation-name of an ejb-relation in the associated ejb-jar.xml descriptor file.

Parent elements:

weblogic-rdbms-relation

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The relation-name element specifies the name of a relation.

relationship-role-name

Range of values:

Valid name

Default value:

n/a

Requirements:

The name must match the ejb-relationship-role-name of an ejb-relationship-role in the associated ejb-jar.xml descriptor file.

Parent elements:

weblogic-rdbms-relation
weblogic-relationship-role

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The relationship-role-name element specifies the name of a relationship role.

table-name

Range of values:

Valid, fully qualified SQL name of the source table in the database.

Default value:

n/a

Requirements:

table-name must be set in all cases.

Parent elements:

weblogic-rdbms-bean

weblogic-rdbms-relation

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The fully qualified SQL name of the table. The user defined for the data-source for this bean must have read and write privileges for this table, but does not necessarily need schema modification privileges.

weblogic-ql

Range of values:

n/a

Default value:

n/a

Requirements:

n/a

Parent elements:

weblogic-rdbms-bean

weblogic-query

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The weblogic-ql element specifies a query that contains a WebLogic specific extension to the ejb-ql language. You should specify queries that only use standard EJB-QL language features in the ejb-jar.xml deployment descriptor.

weblogic-query

Range of values:

n/a

Default value:

n/a

Requirements:

n/a

Parent elements:

weblogic-rdbms-bean

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The weblogic-query element allows you to associate WebLogic specific attributes with a query, as necessary. For example, weblogic-query can be used to specify a query that contains a WebLogic specific extension to EJB-QL. Queries that do not take advantage of WebLogic extensions to EJB-QL should be specified in the ejb-jar.xml deployment descriptor.

Also, the weblogic-query element is used to associate a field-group with the query if the query retrieves an entity bean that should be pre-loaded into the cache by the query.

weblogic-relationship-role

Range of values:

Valid name

Default value:

n/a

Requirements:

The mapping of a role to a table is specified in the associated weblogic-rdbms-bean and ejb-relation elements.

Parent elements:

weblogic-rdbms-relation

Deployment file:

weblogic-cmp-rdbms-jar.xml

Function

The weblogic-relationship-role element is used to express a mapping from a foreign key to a primary key. Only one mapping is specified for one-to-one relationships when the relationship is local. However, with a many-to-many relationship, you must specify two mappings

Multiple column mappings are specified for a single role, it the key is complex. No column-map is specified if the role is just specifying a group-name.

This section describes the 6.1 WebLogic Server-specific XML elements found in weblogic510-cmp-rdbms-jar.xml that are used to define the deployment descriptors in the WebLogic Server EJB container. These elements map to fields, of approximately the same name, in the WebLogic Server Administration Console Use these deployment descriptors for 1.1 EJBs.

RDBMS Definition elements

This section describes the RDBMS definition elements.

pool-name

pool-name specifies name of the WebLogic Server connection pool to use for this EJB's database connectivity.

schema-name

schema-name specifies the schema where the source table is located in the database. This element is required only if you want to use a schema that is not the default schema for the user defined in the EJB's connection pool.

Note: This field is case sensitive, although many SQL implementations ignore case.

table-name

table-name specifies the source table in the database. This element is required in all cases.

Note: The user defined in the EJB's connection pool must have read and write privileges to the specified table, though not necessarily schema modification privileges. This field is case sensitive, although many SQL implementations ignore case.

EJB Field-Mapping elements

This section describes the EJB field-mapping elements.

attribute-map

The attribute-map stanza links a single field in the EJB instance to a particular column in the database table. The attribute-map must have exactly one entry for each field of an EJB that uses WebLogic Server RDBMS-based persistence.

object-link

Each attribute-map entry consists of an object-link stanza, which represents a link between a column in the database and a field in the EJB instance.

bean-field

bean-field specifies the field in the EJB instance that should be populated from the database. This element is case sensitive and must precisely match the name of the field in the bean instance.

The field referenced in this tag must also have a cmp-field element defined in the ejb-jar.xml file for the bean.

dbms-column

dbms-column specifies the database column to which the EJB field is mapped. This tag is case sensitive, although many databases ignore the case.

Note: WebLogic Server does not support quoted RDBMS keywords as entries to dbms-column. For example, you cannot create an attribute map for column names such as "create" or "select" if those names are reserved in the underlying datastore.

Finder elements

This section describes the finder elements.

finder-list

The finder-list stanza defines the set of all finders that are generated to locate sets of beans.

finder-list must contain exactly one entry for each finder method defined in the home interface, except for findByPrimarykey. If an entry is not provided for findByPrimaryKey, one is generated at compilation time.

Note: If you do provide an entry for findByPrimaryKey, WebLogic Server uses that entry without validating it for correctness. In most cases, you should omit an entry for findByPrimaryKey and accept the default, generated method.

finder

The finder stanza describes a finder method defined in the home interface. The elements contained in the finder stanza enable WebLogic Server to identify which method in the home interface is being described, and to perform required database operations.

method-name

method-name defines the name of the finder method in the home interface. This tag must contain the exact name of the method.

method-params

The method-params stanza defines the list of parameters to the finder method being specified in method-name.

Note: WebLogic Server compares this list against the parameter types for the finder method in the EJB's home interface; the order and type for the parameter list must exactly match the order and type defined in the home interface.

method-param

method-param defines the fully-qualified name for the parameter's type. The type name is evaluated into a java.lang.Class object, and the resultant object must precisely match the respective parameter in the EJB's finder method.

You can specify primitive parameters using their primitive names (such as "double" or "int"). If you use a non-primitive data type in a method-param element, you must specify a fully qualified name. For example, use java.sql.Timestamp rather than Timestamp. If you do not use a qualified name, ejbc generates an error message when you compile the deployment unit.

finder-query

finder-query specifies the WebLogic Query Language (WLQL) string that is used to retrieve values from the database for this finder.

Note: Always define the text of the finder-query value using the XML CDATA attribute. Using CDATA ensures that any special characters in the WLQL string do not cause errors when the finder is compiled.

finder-expression

finder-expression specifies a Java language expression to use as a variable in the database query for this finder.

Note: Future versions of the WebLogic Server EJB container will use the EJB QL query language (as required by the EJB 2.0 specification). EJB QL does not provide support for embedded Java expressions. Therefore, to ensure easier upgrades to future EJB containers, create entity EJB finders without embedding Java expressions in WLQL.

 

back to top previous page next page