You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Dhamodharan P <dh...@yahoo.co.uk> on 2002/12/05 10:04:16 UTC

addGroupBy - Please help me!!!!!!!!!

Dear  Thomas,

                    I am trying to use "addGroupBy" method in my project,but it isthroughing following exception:

java.lang.ClassCastException: [Ljava.lang.Object;

 at com.mxic.tdsplus.TestODMGServices.main(TestODMGServices.java:40)


Just go through my code below and check the while loop condition, if it is wrong just guide me.

 

package com.mxic.tdsplus;
import java.util.*;
import com.mxic.tdsplus.leadscan.*;
import org.apache.ojb.broker.query.*;
import org.apache.ojb.broker.PersistenceBroker;
import org.apache.ojb.broker.PersistenceBrokerFactory;


public class TestODMGServices
{

  public TestODMGServices() {
  }

 public static void main(String[] dhamu)
 {
   java.util.Iterator iter=null;
      try
        {
       
      PersistenceBroker broker=PersistenceBrokerFactory.defaultPersistenceBroker();

      Criteria crit1 = new Criteria();
      ReportQueryByCriteria q = QueryFactory.newReportQuery(LotSummaryForm.class, crit1);
      q.setColumns(new String[] {"LOT_NO"});
      crit1.addGroupBy("LOT_NO");
      iter = broker.getReportQueryIteratorByQuery(q);
     
             while(iter.hasNext())
             {
             LotSummaryForm lot_item_form=(LotSummaryForm)iter.next();
             System.out.println("Lot_no = "+lot_item_form.getLot_no());
             }
             broker.close();

       }
        catch (Exception ex)
        {
           ex.printStackTrace();
           System.out.println(ex.getMessage());
        }

    }
 }


 

Thanks in Advance

Dhamu



---------------------------------
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now