Thanks so much for all your help!
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?
Thanks again!
DR
Andrus Adamchik <andru..bjectstyle.org> wrote:
Denna,
You better avoid deleting data from DB directly. You may end up with
an inconsistent object graph ... and generally if you work in the ORM
object space, why bother with SQL.
So just get a hold of an object in question and then do:
dataContext.deleteObject(object);
dataContext.commitChanges()
Andrus
On Jun 6, 2005, at 11:51 AM, Dhruti Ramani wrote:
> Hi,
>
> I have to remove a DoListItem whose type is 'xyz' for particular
> Deal (so basically query uses two tables). How do I delete that
> particular object? I was trying to use SQLTemplate but it returns
> Map so i can not bind that to particular object.
>
> Any ideal?
> Thanks,
> Denna
---------------------------------
Discover Yahoo!
Find restaurants, movies, travel & more fun for the weekend. Check it out!
This archive was generated by hypermail 2.0.0 : Thu Jun 16 2005 - 12:10:07 EDT