Chapter 8. Developing Entity Beans
8.9.2. Standard Deployment Descriptor
The standard way to indicate to an EJB platform that an Entity Bean has container-managed
persistence is to fill the
, and to fill the
container
container-managed fields (the fields that the container will have in charge to make persistent) and the
tags identifying the relationships. The CMP version (1.x or 2.x) should also be
cmr-field
specified in the
cmp-version
descriptor:
persistence-type container /persistence-type
cmp-version 1.x /cmp-version
cmp-field
field-name fieldOne /field-name
/cmp-field
cmp-field
field-name fieldTwo /field-name
/cmp-field
Warning
To run CMP1.1-defined Entity Beans on an EJB2.0 platform, such as JOnAS 3.x, you must introduce
the
cmp-version
(if not specified) is 2.x.
Note that for CMP 2.0, the information defining the behavior of the implementation of a
method is located in the standard deployment descriptor as an EJB-QL query (this
find method
is not JOnAS-specific information). For CMP 1.1, this information is located in the JOnAS-specific
deployment descriptor as an SQL
element.
The following example shows a finder method in CMP 2.0 for a
method defined on the Account Entity Bean of the JOnAS
val)
query
query-method
method-name findLargeAccounts /method-name
method-params
method-param double /method-param
/method-params
/query-method
ejb-ql SELECT OBJECT(o) FROM accountsample o
WHERE o.balance
/query
8.10. JOnAS Database Mappers
For implementing the EJB 2.0 persistence (CMP2.0), JOnAS relies on the JORM framework (see
http://www.objectweb.org/jorm/index.html). JORM itself relies on JOnAS DataSources (specified
in DataSource properties files) for connecting to the actual database. JORM must adapt its object-
relational mapping to the underlying database, for which it makes use of adapters called mappers.
persistence-type
cmp-field
tag. This is represented by the following lines in the deployment
element in your deployment descriptors, because the default cmp-version value
clause specified in a
WHERE
?1 /ejb-ql
tag of the deployment descriptor with the value
tags of the deployment descriptor with the list of
example.
eb
finder-method-jdbc-mapping
findLargeAccounts(double
95
Need help?
Do you have a question about the APPLICATION SERVER - JONAS and is the answer not in the manual?
Questions and answers