Re: Need help with removing some object

From: Dhruti Ramani (dhrutiraman..ahoo.com)
Date: Mon Jun 06 2005 - 16:11:59 EDT

  • Next message: McDaniel, Joe: "Re: Need help with removing some object"

    Thanks, I have read about that. Thats what I was trying to do. I was trying to get object from database and then use deleteObject method. But my query depends on two tables and I dont know how to get hold of particular object. If I use SQLTemplate it return results in turms of Map, but I need to get Object to delete it.
     
    Is there any other way to do this?
    Thanks,
    Denna
    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!
     Have fun online with music videos, cool games, IM & more. Check it out!



    This archive was generated by hypermail 2.0.0 : Mon Jun 06 2005 - 16:12:04 EDT