|
Problem(Abstract) |
Can you set up a CMP enterprise bean with both the
Enterprise JavaBeans relation "Cascade delete" assembly setting and the
Oracle database "Cascade delete" Foreign Key function? |
|
|
|
Resolving the
problem |
In the IBM WebSphere Application Server V5.0 Information
Center, the EJB
relation assembly settings describe the Enterprise JavaBeans relation
as a relationship between two entity beans with container-managed
persistence (CMP).
Cascade delete is described as within a particular relationship,
and it specifies that the lifespan of one or more entity beans is
dependent upon the lifespan of another entity bean. Cascade delete can be
specified only for an Enterprise JavaBeans relationship role contained in
an Enterprise JavaBeans relation in which the other Enterprise JavaBeans
relationship role specifies a multiplicity. Multiplicity can be thought of
as specifying the multiplicity of the role that participates in a
relation.
In general, for an enterprise bean, if it is designed to be CMP or CRM,
the application should allow the Persistence Manager to handle all of the
operations. If there is a "third-person" intervention on the Container
Managed xxx operation, there might be undesirable side-effects. For
example, depending on who (Persistence Manager or Database Manager)
removes the relationship first, the second component coming in might or
might not handle the removal correctly (For example, exception handling).
The Persistence Manager usually ignores exceptions if the relation does
not exist. However, it is not guaranteed from the Database perspective.
The bottom line is that if the application uses Container Managed
semantics, then the container and the Persistence Manager should be
allowed to perform their job. External interference is not
recommended. |
|
|
|
|
Cross Reference information |
Segment |
Product |
Component |
Platform |
Version |
Edition |
Application Servers |
Runtimes for Java Technology |
Java SDK |
|
|
|
|
|
|