how can i delete all the rows?

From: S e r g i o (killer_freak..otmail.com)
Date: Tue Aug 24 2004 - 11:20:57 EDT

  • Next message: Tore Halset: "Re: SQLTemplate with addPrefetch?"

    Hi!

    I want to delete all the objects from the database. I have tried something
    like this:

    String likePattern = "%1";
    Expression qual = ExpressionFactory.likeIgnoreCaseExp("nombre",
    likePattern);
    DeleteQuery query = new DeleteQuery(Personas.class, qual);

    why can't i do something like "context.performQuery(query);" to delete all
    the rows????

    Instead of this, i have to do something like this, but i think it isn't the
    best wat, is it??

    SelectQuery query = new SelectQuery(Personas.class, qual);
    Personas persona=null;
    List result = ctxt.performQuery(query);
    for (int i = 0; i<result.size(); i++)
            {
                   persona= (Personas)result.get(i);
            ctxt.deleteObject(persona);
              }
    ctxt.commitChanges();

    thanks!
    Sergio

    _________________________________________________________________
    Dale rienda suelta a tu tiempo libre. Encuentra mil ideas para exprimir tu
    ocio con MSN Entretenimiento. http://entretenimiento.msn.es/



    This archive was generated by hypermail 2.0.0 : Tue Aug 24 2004 - 11:21:03 EDT