Re: Need help with removing some object

From: Mike Kienenberger (mkienen..laska.net)
Date: Thu Jun 16 2005 - 12:37:00 EDT

  • Next message: Alan Guo: "Can cayenne work with DB2 running on AS 400?"

    Dhruti Ramani <dhrutiraman..ahoo.com> wrote:
    > After doing
    > dataContext.deleteObject(object);
    > dataContext.commitChanges()
    >
    > the object referring to the deleted object still has a pointer to it. I
    was assuming that all
    > references to that object would be removed from all places in the object
    model.
    > Did I get that wrong? If that is the behavior that I want, how do I
    arrange
    > for this?
    >
    > The reference in question is a one-to-many where my Deal object has any
    > number of DoListItems items hanging off if it.
    >
    > The behavior that I see is that the DoListItem is deleted from the
    > database but still appears to be referenced by the Deal object's java
    > collection.
    >
    > Should I delete it from that collection explicitly before or after I
    delete it from the databased with deleteObject()?
    >
    > I have printed out state of that object. Before deleting, the state is
    "Committed" and after its "transient".
    >
    > If all I want is for no objects to reference the deleted object, how
    should I arrange that?

    If you set your delete rules in the modeler, I think this will be handled
    automatically for you.

    http://www.objectstyle.org/cayenne/modelerguide/modeling-object-layer/delete-
    rules.html



    This archive was generated by hypermail 2.0.0 : Thu Jun 16 2005 - 12:34:21 EDT