I've found one answer to my own question, but I'm not sure that is the best
one  ;-)

Knows anyone a better or nicer way to get the same result?

---
    public static Vector getPendingOrders( int Id ) throws Exception
    {
        Criteria criteria = new Criteria();
        criteria.add(OrdersPeer.PRODUCTID,Id);
        criteria.addJoin(CompaniesPeer.COMPANYID,CompaniesPeer.ID);
        criteria.addAscendingOrderByColumn(OrdersPeer.ORDERDATE);
        criteria.addSelectColumn(OrdersPeer.ID);                  // watch
the order of columns
        criteria.addSelectColumn(OrdersPeer.QUANTITY);
        criteria.addSelectColumn(OrdersPeer.ORDERDATE);
        criteria.addSelectColumn(OrdersPeer.ARRIVEDATE);
        criteria.addSelectColumn(CompaniesPeer.COMPANY);

        Vector results = new Vector();

        Vector resultset =
OrdersPeer.executeQuery(OrdersPeer.createQueryString(criteria));

        for (int x=0; x<resultset.size(); x++)
        {
            Record r = (Record)resultset.elementAt(x);

            Hashtable h = new Hashtable();

            h.put( "Id", r.getValue(1).asString() );
            h.put( "Quantity", r.getValue(2).asString() );
            h.put( "Orderdate", r.getValue(3).asString() );
            h.put( "Arrivedate", r.getValue(4).asString() );
            h.put( "Company", r.getValue(5).asString() );

            results.add( h );
        }

        return results;
    }

---

Andrea Papotti


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to