context.objectsFromDataRows behaviour

From: Steve Wells (stwell..wnmail.net)
Date: Wed Feb 09 2005 - 01:46:44 EST

  • Next message: Pirola Davide: "RE: maximum open cursors exceeded (with Stored Procedure)"

    Hi all,

    Sadly I have to call stored procs to SQL server, am using jtds 1.0 and
    Cayenne 1.2M2. So I created a DataObject and try to convert from rows
    to objects.

    This works:
    List rows = context.performQuery(query);
    // process results
    Iterator it = rows.iterator();
    while (it.hasNext()) {
         DataRow row = (DataRow) it.next();

           // do something with result, e.g. instantiate a real DataObject
           DocInfo object = (DocInfo)
           context.objectFromDataRow(DocInfo.class, row, true);
           log.info(object);
    }

    But this does NOT:
    List list = context.objectsFromDataRows(DocInfo.class, rows, false,
    false);
    for (int i = 0; i < list.size(); i++) {
        Object o = list.get(i);
            log.info(o);
    }

    What I get is always the first row repeated from the original resultset.
     If the query returns 100 rows, I get the first result from that set in
    the variable called "list", 100 times. Also if I set refresh param to
    true I get the last result 100 times
    (context.objectsFromDataRows(DocInfo.class, rows, true, false))

    Anyone else been using this sucessfully with SP's?

    Also which would be the recommended technique anyway?

    Thanks,

    Steve



    This archive was generated by hypermail 2.0.0 : Wed Feb 09 2005 - 01:46:49 EST