Re: read Row

From: jsaa..eb.de
Date: Fri Jun 25 2004 - 07:26:12 EDT

  • Next message: Matt Kerr: "Re: Use Query in Cayenne"

    "Jürgen Saar" <Juerge..Saar.org> schrieb am 25.06.04 13:23:37:

    The ResultIterator only brings PrimaryKeys.
    It is my favorite way, because it also works
    with huge results. So I use the performIteratedQuery
    for the query as such, and the performQuery for
    the data (on primary key only 1 datarow)

    here a code snipplet:
    ----------------------

    private ResultIterator result;
    ...
    Map dummy = result.nextObjectId();
    Expression prim = ExpressionFactory.matchAllExp(dummy, Expression.EQUAL_TO);
    if (prim != null) {
            SelectQuery row = new SelectQuery(myObject.getClass(), prim);
            List dataRow = context().performQuery(row);
            myObject = (MyDataObject) dataRow.get(0);
    }
    ...

    "Sako!" <webobject..tcc.datos.de> schrieb am 24.06.04 15:20:44:
    >
    > how to read the values from the result then?
    > i tried this:
    > -----------------------------------------------------
    > private DataContext createContext() {
    > Configuration.bootstrapSharedConfiguration(this.getClass());
    > return
    > Configuration.getSharedConfiguration().getDomain().createDataContext();
    > }
    > -----------------------------------------------------
    > private DataContext ctxt;
    >
    > this.ctxt = createContext();
    > Expression qual =
    > ExpressionFactory.likeIgnoreCaseExp("galleryName",likePattern);
    > SelectQuery query = new SelectQuery(<yourBusinessClass>, qual);
    >
    > yourBusinessClass a = null;
    >
    > try
    > {
    > ResultIterator result = ctxt.performIteratedQuery(query);
    > System.out.println(" done! " );
    >
    > a = (yourBusinessClass)result;
    > }
    > catch(Exception e)
    > {
    > System.out.println("error : " + e);
    > }
    > System.out.println("and : " + a.getgalleryName());
    > -----------------------------------------------------
    > but it didnt work.
    >
    > thanks in advance!
    > Sako

    _____________________________________________________________________
    Wenn Worte allein nicht ausreichen: WEB.DE Video-Mail -
    Die E-Mail der nächsten Generation! http://freemail.web.de/?mc=021197



    This archive was generated by hypermail 2.0.0 : Fri Jun 25 2004 - 07:26:15 EDT