First, per your reply, you're right, removing from a collection and
cascading delete aren't related. It is similar when you are deleting an
entity and want the children deleted. Like you said, you can call the remove
method from ejbRemove(). However, the collection piece (at least the way
Toplink works) is the same vehicle, where if the relationship is altered,
the child is handled automatically.
I'll try and explain. If I use a one-to-many relationship with CMP, which
Orion supports by adding a property like:
public Vector ChildVector;
public Class ChildVector_type=classInVector.class;
With Orion, when I add a remote reference to an entity bean to the
collection, Orion will maintain the relationship. This allows me to add
object references by simply creating a remote reference. However, if I want
to delete one from the collection, I don't believe that it is enough to
simply remove the reference from the collection. I believe it would remove
the relationship, but I suspect that the child object would still remain. If
the client was handling the remote references directly, this would be
resolved by calling remove() at the same time I remove it's reference from
the collection.
Now, if I implement something like the Detail pattern where I pass a
serializable representation (detail object) of my entity to the client so
that I can reduce the number of network and db calls, the client would
simply remove the reference from the collection. Since it is not a reference
to a remote interface, there is no remove method(). The way I see it, I have
two options. One option is to expand the detail object so that it maintains
a reference to anything removed so that I know what to delete when the
detail object is converted back into the entity, or a do a compare when I
retrieve the entity and merge it with the passed back detail object. Ugh, in
both cases.
I guess what I'm looking for (but don't expect to find) is something similar
to the way that Toplink handles this. Of course Toplink for Java doesn't do
entity beans with CMP (there is a Toplink build for Weblogic that supposedly
does all the fancy OR mapping that Toplink for Java does, but does it with
CMP). What Toplink does, when you map out your objects, child references
(including those in collections) can be marked as private. When they are
marked as private, if the parent is deleted, or the parents reference to the
child is changed, then the all private children are deleted. If a child is
marked as not private, then it remains and has to be managed manually.
On the project I'm doing currently, we are using Toplink for Java for our OR
mapping. It greatly simplifies life and I guess it has spoiled me. Toplink
for Java could be used with Orion to accomplish the above tasks if I abandon
entity beans and only use session beans. This would be ok except for the
price points. One of the advantages of going with Orion is, of course, it's
$1500 price tag. Toplink currently costs around $5000 per developer.
Needless to say, if I'm trying to make a pitch for a low cost solution, it
doesn't sit will to spend $1500 to $4500 for the app server and $15000 to
$25000 for the OR mapping tool. :(
Anyway, enough rambling. I guess my feel is that Weblogic plus Toplink is a
solid combo for clients with deeper pockets that want name brand, but I'm
hoping that Orion can fill the void for smaller clients. It would be neat to
see some Toplink like features in Orion, even if they do tie you to the app
server. BTW, I haven't checked out the EJB 2.0 spec regarding OR mapping.
Does it address any of this?
Bill
-----Original Message-----
From: Nick Newman
To: [EMAIL PROTECTED]
Sent: 9/20/00 6:08 PM
Subject: RE: Deletes with Complex OR Mapping
Perhaps I don't really understand the problem. What does adding and
removing from collections have to do with "cascading deletes"?
Nick
At 04:07 PM 9/19/00 -0400, you wrote:
>What about the case where you are replacing a child. Example: Adding to
a
>collection or removing from a collection.
>
>-----Original Message-----
>From: Nick Newman [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, September 19, 2000 2:10 PM
>To: Orion-Interest
>Subject: Re: Deletes with Complex OR Mapping
>
>
>Hi Bill,
>
>Inside the ejbRemove method (which is called automatically by the
>container) just ask it to remove the "child" beans.
>
>Nick
>
>At 01:24 PM 9/19/00 -0400, you wrote:
>>Is there a way to instruct the container to delete ejbs referenced
from
>>parent ejbs that are being deleting (something like a cascading
delete)
>when
>>using CMP? If not, What is the best way to do this, expecially if you
are
>>passing a value object passed in through a session bean (Details
pattern @
>>www.theserverside.com)? I ask this because I've been spoiled by a
feature
>in
>>TOPLink where you can define an object reference as "privately" owned
and
>it
>>will be automatically deleted. If marked as not private, then you have
to
>>manually delete it.
>>
>>TIA,
>>Bill
>>
>>=====================
>>Bill Smith
>>Senior Software Engineer
>>iXL, Inc.
>>4600 Cox Rd.
>>Glen Allen, VA 23060
>>
>>tel: 804.217.8888
>>fax: 804.217.8890
>>[EMAIL PROTECTED]
>>
>>This message is intended only for the use of the Addressee and may
contain
>>information that is PRIVILEGED and CONFIDENTIAL. If you are not the
>intended
>>recipient, dissemination of this communication is prohibited. If you
have
>>received this communication in error, please erase all copies of the
>message
>>and its attachments and notify us immediately.
>>
>>
>