It is definitely possible to fetch DataObjects with SQLTemplate by
using the right column names (and calling "setFetchingDataRows
(false)" before the fetch), but before you go in this direction, make
sure it is not possible to use a simple SelectQuery (e.g. if you are
using aggregate functions in qualifier).
And finally chances are your related DoListItems are already in
memory, and you can simply iterate over a list returned from a a Deal
XYZ relationship, check which object(s) match the condition and
delete this object.
Andrus
On Jun 6, 2005, at 4:11 PM, Dhruti Ramani wrote:
> 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:23:22 EDT