Chapter 8. Developing Entity Beans
95
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
>
persistence-type
?
tag of the deployment descriptor with the value
container
, and to fill the
>
cmp-field
?
tags of the deployment descriptor with the list of
container-managed fields (the fields that the container will have in charge to make persistent) and the
>
cmr-field
?
tags identifying the relationships. The CMP version (1.x or 2.x) should also be
specified in the
>
cmp-version
?
tag. This is represented by the following lines in the deployment
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
A
element in your deployment descriptors, because the default cmp-version value
(if not specified) is 2.x.
Note that for CMP 2.0, the information defining the behavior of the implementation of a
find
>
method
?
method is located in
the standard deployment descriptor
as an EJB-QL query (this
is
not
JOnAS-specific information). For CMP 1.1, this information is located in the JOnAS-specific
deployment descriptor as an SQL
WHERE
clause specified in a
B
finder-method-jdbc-mapping
C
element.
The following example shows a finder method in CMP 2.0 for a
findLargeAccounts(double
val)
method defined on the Account Entity Bean of the JOnAS
eb
example.
>
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
?
?1
>
/ejb-ql
?
>
/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
.
Содержание Application Server
Страница 1: ...Red Hat Application Server JOnAS User Guide ...
Страница 8: ......
Страница 22: ...14 Chapter 1 Java Open Application Server JOnAS a J2EE Platform ...
Страница 58: ...50 Chapter 3 JOnAS Configuration ...
Страница 66: ...58 Chapter 5 JOnAS Class Loader Hierarchy ...
Страница 78: ...70 Chapter 6 JOnAS Command Reference ...
Страница 80: ......
Страница 86: ...78 Chapter 7 Developing Session Beans ...
Страница 136: ...128 Chapter 9 Developing Message Driven Beans ...
Страница 142: ...134 Chapter 10 Defining the Deployment Descriptor ...
Страница 148: ...140 Chapter 11 Transactional Behavior of EJB Applications ...
Страница 158: ...150 Chapter 14 EJB Packaging ...
Страница 162: ...154 Chapter 15 Application Deployment and Installation Guide ...
Страница 164: ......
Страница 176: ...168 Chapter 18 WAR Packaging ...
Страница 178: ......
Страница 184: ...176 Chapter 20 Defining the Client Deployment Descriptor ...
Страница 186: ...178 Chapter 21 Client Packaging ...
Страница 188: ......
Страница 192: ...184 Chapter 23 EAR Packaging ...
Страница 194: ......
Страница 200: ...192 Chapter 24 JOnAS Services ...
Страница 204: ...196 Chapter 25 JOnAS and the Connector Architecture ...
Страница 222: ...214 Chapter 27 Ant EJB Tasks Using EJB JAR ...
Страница 234: ...226 Chapter 29 Web Services with JOnAS ...
Страница 236: ......
Страница 260: ...252 Chapter 34 How to use Axis in JOnAS ...
Страница 270: ...262 Chapter 36 Web Service Interoperability between JOnAS and BEA WebLogic ...
Страница 296: ......