File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Cascade-delete & multiplicity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Cascade-delete & multiplicity" Watch "Cascade-delete & multiplicity" New topic

Cascade-delete & multiplicity

saran ram
Ranch Hand

Joined: Dec 13, 2002
Posts: 69
In HFEJB 420, in the BulletPoint about Cascade-delete,it says,
Cascade-delete works only if the bean has a multiplicity of One.
In Page 395, DirectorBean has Multiplicity as One and MovieBean has Multiplicity as Many. Here Cascade-delete comes in MovieBean? Am I missing something here?
Timothy Toe
Ranch Hand

Joined: Oct 19, 2002
Posts: 156
You can optionally specify a role as Cascade-delete in the DD if and only if the OTHER PARTY in the relationship has a multiplicity of One.

This means that Many-to-Many relationships cannot have Cascade-delete in either of the 2 ends (roles).

I hope this does not confuse you but it helps me : I always think of the role as having Cascade-delete as the "weaker" role. The Movie role is "weaker", that's why it is allowed to have the optional Cascade-delete attribute. "Weaker" in the sense that when a Director is deleted, all the movie bean related to that director will be deleted. The "power" is at the Director's end (role).
saran ram
Ranch Hand

Joined: Dec 13, 2002
Posts: 69
Thank you timothy, I got it now, so its the other party in the relationship should have multiplicity one.
I agree. Here's the link:
subject: Cascade-delete & multiplicity
jQuery in Action, 3rd edition