Hi,

Use pb.getReportQueryIteratorByQuery for such queries.

cheers,
Thomas

> -----Urspr�ngliche Nachricht-----
> Von: Dhamodharan P [mailto:[EMAIL PROTECTED]]
> Gesendet: Freitag, 6. Dezember 2002 10:48
> An: OJB Users List
> Betreff: QueryBySql, please help me (URGENT)
> 
> 
> 
> Dear all,
> 
>            I am using QueryBySql, its working fine for all 
> record selection but its not working for DISTINCT, not even 
> for specific column.Please help me, my project is in tight 
> schedule.Just have look on my code:
> 
> 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 TestQueryBySql
> {
> 
>   public TestQueryBySql() {
>   }
> 
>  public static void main(String[] dhamu)
>  {
> 
>    java.util.Iterator iter=null;
>       try
>         {
>    PersistenceBroker 
> broker=PersistenceBrokerFactory.defaultPersistenceBroker();//c
reatePersistenceBroker("repository.xml");
> 
>   QueryBySQL queryBySql=new 
> QueryBySQL(LotSummaryForm.class,"SELECT DISTINCT(LOT_NO) FROM 
> LS_LOT_SUMMARY");
>      System.out.println("Query " +queryBySql.getSql());
>      Collection results = broker.getCollectionByQuery(queryBySql);
> 
>         iter = results.iterator();
> 
>     while(iter.hasNext())
>     {
>     LotSummaryForm lot_summary_form=(LotSummaryForm)iter.next();
>     System.out.println("Lot_NO = "+lot_summary_form.getLot_no());
> 
>     }
> 
>        }
>         catch (Exception ex)
>         {
>            ex.printStackTrace();
>            System.out.println(ex.getMessage());
>         }
> 
>     }
>  }
> 
> 
> Thanks in Advance
> 
> Dhamu
> 
>   
> 
> 
> 
> 
> ---------------------------------
> With Yahoo! Mail you can get a bigger mailbox -- choose a 
> size that fits your needs
> 


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

Reply via email to