The container attempts to create the table based on information found in the deployment files and in the bean class. If table creation fails, a ' Table Not Found' error is thrown, and the user must create the table manually.
The container drops and recreates the table during deployment only if columns have changed. The container does not save data. You must ensure that the column type and cmp-field types are compatible. The EJB container does not attempt to ensure the column type and cmp-field types are compatible. The container drops and creates the table during deployment whether or not columns have changed. The container does not save the data.
The container creates the table if it does not yet exist. If the table does exist, the container alters the table schema. Table data is saved. Note : Do not choose this setting if a new column is specified as a primary key or if a column with null values is specified as the new primary key column. If the SEQUENCE's increment value does not match the value of the k ey-cache-size element, the container alters the increment value to match the value of key-cache-size. If the SEQUENCE's increment value does not match the value of the key-cache-size element, the container alters the increment value to match the value of key-cache-size.
The following example specifies the create-default-dbms-tables element. Requirements: database-type must be specified. The database-specific-sql element specifies a database-specific SQL statement. The database-type element specifies the database used as the underlying WebLogic Server dbms or the dbms against which to execute a vendor-specific SQL statement. If you specify database-type in the weblogic-rdbms-jar element, the database you specify applies to the entire weblogic-rdbms-jar deployment descriptor file unless it is overridden in a database-specific-sql element by another database-type element.
Specifies the JDBC data source name to be used for database connectivity for this bean. Default value: By default, database cascade delete is not used. Allows an application to take advantage of a database's built-in support for cascade delete, and possibly improve performance. This functionality is supported only for:. If db-cascade-delete is enabled in weblogic-cmp-rdbms-jar.
If db-cascade-delete is not specified, do not enable the database's cascade delete functionality, as this will produce incorrect results. The following Oracle database table definition will cause deletion all of the emp rows if the owning dept is deleted in the database. Requirements: To specify Blob or Clob in this element, you must also set dbms-default-value to Oracle or DB2 databases. Specifies the type of the cmp-field. LongString —tells the container to use setCharacterStream to write String data into the database.
Specifies the database used as the default underlying dbms. This value can be overridden by the database-type element. Specifies when a new CMP bean is inserted into the database. The allowable values cause the following behavior:.
This setting yields better performance than ejbCreate by avoiding an unnecessary store operation. This element has an effect only when order-database-operations is False. By default, order-database-operations is true , which causes new beans to be inserted at the transaction commit time.
Delaying the database insert until after ejbPostCreate is required 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.
For maximum flexibility, avoid creating related beans in your ejbPostCreate method. If ejbPostCreate creates related beans, and database constraints prevent related beans from referring to a bean that has not yet been created, it is not possible to perform a database insert until after the method completion.
The description element provides text that describes the parent element. This element, introduced in WebLogic Server 9. It is used to specify whether a cmp-field of type string[] should be trimmed. Set this flag to True to disable string trimming.
Range of values: Must match the ejb-name of a cmp entity bean defined in the ejb-jar. The name that specifies an EJB as defined in the ejb-cmp-rdbms. This name must match the ejb-name of a cmp entity bean contained in the ejb-jar. If this element is set to True , the EJB delays database operations in a transaction until commit time. The following XML sample demonstrates use of the enable-batch-operations element:. Caching read-only entity EJBs at the query level improves performance because it enables the EJBs to be accessed in cache by any finder, thereby avoiding the need to access the database.
If you set this value to True , you can specify the maximum number of queries to cache at the application or bean level. To specify the maximum number of queries to cache, set max-queries-in-cache in the weblogic-ejb-jar. For information, see max-queries-in-cache.
The following XML sample demonstrates use of the enable-query-caching element:. Default value: A special group named default is used for finders and relationships that have no field-group specified. The default group contains all of a bean's cmp-fields, but none of its cmr-fields. The field-group element represents a subset of the cmp-field s and cmr-field s 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. The field-map element represents a mapping between a particular column in a database and a cmp-field in the bean instance. The optional group-name element specifies a field group that is to be loaded when the getXXX method for the cmp-field is called and the EJB container needs to read the value from the DBMS because it is not in memory. If group-name is omitted, the default group, which contains all cmp-field s, is used when the cmp-field is not explicitly listed in any field groups, otherwise a field group that contains the cmp-field is chosen.
Thus, developers should specify a group-name if the cmp-field is listed in multiple field groups or the container will pick one of the groups arbitrarily. It is used to specify whether finders can return null results. The foreign-key-column element represents a column of a foreign key in the database. The foreign-key-table element specifies the name of a DBMS table that contains a foreign key. See relationship-role-map. The generator-name element is used to specify the name of the primary key generator.
See automatic-key-generation. Range of values: Identity Sequence SequenceTable. The generator-type element specifies the primary key generation method to use. Sequence : Oracle, DB2, and Informix version 9. Default value: False for beans that use optimistic concurrency. True for beans that use other concurrency types. Specifies whether 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. A value of False provides best performance. Specifies a locking or processing order for instances of a particular EJB. This element can be used to prevent deadlocks in an application that would otherwise experience deadlocks. It specifies an order for operations that can cause a database lock to be acquired for a bean instance.
For example, instance-lock-order could be used to specify the order in which the EJB container calls ejbStore for instances of a particular EJB that uses database concurrency; ejbStore may acquire an exclusive lock when a database update is done. AccessOrder —The container will process beans so that locks are acquired or upgraded in the order in which the application originally accessed the beans during the transaction.
This is the recommended value when all transactions in the system access instances of the bean, and ultimately rows in a database table, in the same order. ValueOrder —Beans are processed in order based on the value of their primary key. ValueOrder should be specified to avoid deadlocks when concurrent transactions access instances of the same EJB in different orders.
The EJB's primary key class is not required to implement the java. Comparable interface when ValueOrder is specified, although this will result in a total ordering. Beans are ordered partially using the hash code value of the primary key when the primary key does not implement java. Comparabl e. Specifies the optional size of the primary key cache available in the automatic primary key generation feature.
The key-column element represents a column of a primary key in the database. Use this flag to specify the database locking order of an entity bean when a transaction involves multiple beans and exclusive concurrency. The bean with the lowest number is locked first. This flag should only be used to prevent a deadlock situation and, currently, only applies when a transaction performs cascade deletes.
The method-name element specifies the name of a finder or ejbSelect method. The method-param element contains the fully qualified Java type name of a method parameter. The method-params element contains an ordered list of the fully-qualified Java type names of the method parameters. The optimistic-column element denotes a database column that contains a version or timestamp value used to implement optimistic concurrency.
For more information on optimistic concurrency, see Choosing a Concurrency Strategy. The following sample XML shows the use of the optimistic-column element. If enable-batch-operations is set to True , the container automatically sets order-database-operations to True.
To turn off order-database-operations , set both order-database-operations and enable-batch-operations to False. See also ejb-ql-query and delay-database-insert-until. The primary-key-table element specifies the name of a DBMS table that contains a primary key. For more information about primary keys, see Using Primary Keys. Specifies the method that is associated with a weblogic-query. It also uses the same format as the ejb-jar.
Range of values: Must match the ejb-relation-name of an ejb-relation in the associated ejb-jar. The ejb-relation-name is optional, but is required for each relationship defined in the associated ejb-jar. The relationship-caching element specifies relationship caching. The relationship-caching element can contain the elements shown here:.
The relationship-role-map element specifies foreign key column to key column mapping for beans involved in a relationship. If the bean on the foreign key side of a one-to-one or one-to-many relationship is mapped to multiple tables, then the name of the table containing the foreign-key columns must be specified using the foreign-key-table element.
Conversely, if the bean on the primary key side of a one-to-one or one-to-many relationship or a bean participating in a m-n relationship is mapped to multiple tables, then the name of the table containing the primary key must be specified using the primary-key-table element. If neither of the beans in a relationship is mapped to multiple tables, then the foreign-key-table and primary-key-table elements can be omitted because the tables being used are implicit.
The table that holds the foreign key columns must be specified in the foreign-key-table element. The foreign-key-table element must be specified so that the container can know which table contains the foreign key columns. Range of values: Must match the ejb-relationship-role-name of an ejb-relationship-role in the associated ejb-jar. The relationship-role-name element specifies the name of a relationship role.
See the examples for weblogic-relationship-role. It is used to specify whether a cmp-field of type byte[] mapped to a Blob in an Oracle database should be serialized. By default, the value of the tag is false , which means that the container will persist the byte[] directly and not serialize it. The glassfish-application-client. The sun-acc. The glassfish-resources. GlassFish Server offers limited support for the weblogic-application. The only element in weblogic-application.
The equivalent element in the glassfish-application. The elements of weblogic. Table B-2 weblogic. The elements of weblogic-webservices. Table B-3 weblogic-webservices. Similar to endpoint-address-uri in glassfish-web.
Accepts true or false , defaults to true. Controls the publishing of WSDL to clients. Accepts true or false , defaults to false. Maps to ReliableMessagingFeature. Returns enum values, one of them is exponential. Declares the EJB's reference to an external resource. Links a security role reference to a defined security role. Specifies the name of a security role.
Defines a security role. Declares a security role reference in the EJB's code. Specifies the type of a session bean stateful or stateless. Declares a session bean. Specifies the name of a file containing a small 16 x 16 icon image. Specifies the transaction management type of an EJB bean- or container-managed. Specifies how the container must manage the transaction boundaries when delegating a method invocation to an EJB's business method. EJB Role. The optional primkey-field may be present in the descriptor if the entity's persistence-type is Container.
At least one cmp-field element must be present in the descriptor if the entity's persistency-type is Container , and none must not be present if the entity's persistence-type is Bean. Boolean java. String java. Integer java. Double java. Byte java. Short java. Long java. Float EJB Role. The filename must end with the suffix.
The ejb-name element must be the name of one of the EJBs declared in the deployment descriptor. The security roles used in the method-permission element must be defined in the security-role element of the deployment descriptor. If the definition of the primary key class is deferred to deployment time, the prim-key-class element should specify java. The primkey-field must be one of the fields declared in the cmp-field element.
0コメント