Hi again,

Yes, it's better:

----code----
while (iter.hasNext()) {
        Object[] ob = (Object[]) iter.next();
        String name = (String) ob[0];
        System.out.println(name);
----code----

Thanks
Regards
Sylvain


-----Message d'origine-----
De: Charles Anthony [mailto:[EMAIL PROTECTED]
Date: lundi, 24. mars 2003 11:14
�: 'OJB Users List'
Objet: RE: Which object comes from ReportQueries ?


Pretty much, yes...
Of course, you should be able to work out which class of object it is and
cast it appropriately (e.g. if workstationType column is a VARCHAR, cast to
string etc.)

>-----Original Message-----
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>Sent: 24 March 2003 10:05
>To: [EMAIL PROTECTED]
>Subject: RE: Which object comes from ReportQueries ?
>
>
>Hi Charles,
>
>Thanks.
>
>So I should write:
>
>----code----
>while (iter.hasNext()) {
>  Object[] ob = (Object[]) iter.next();
>  System.out.println(ob[0]);
>}
>----code----
>
>
>Regards
>Sylvain
>
>
>-----Message d'origine-----
>De: Charles Anthony [mailto:[EMAIL PROTECTED]
>Date: lundi, 24. mars 2003 10:38
>�: 'OJB Users List'
>Objet: RE: Which object comes from ReportQueries ?
>
>
>Report queries do not return materialized objects ! 
>
>The iterator.next() returns an object array (Object[]) 
>consisting of the
>columns returned from your query. 
>
>In your code, it would be a one dimensional array containing 
>the value of
>the column that is mapped to Workstation.workstationType
>
>Cheers,
>Charles.
>
>>-----Original Message-----
>>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>>Sent: 24 March 2003 09:34
>>To: [EMAIL PROTECTED]
>>Subject: Which object comes from ReportQueries ?
>>
>>
>>Hello,
>>
>>I'm trying to use ReportQueries. Here my code:
>>
>>----code----
>>String sql = "select w.workstationType from Workstation w";
>>
>>Query query = QueryFactory.newQuery(Workstation.class, sql);
>>
>>try {
>>      broker.beginTransaction();
>>      Iterator iter = broker.getReportQueryIteratorByQuery(query);
>>
>>      while (iter.hasNext()) {
>>      Workstation workstation = (Workstation) iter.next();
>>      System.out.println(workstation.getWorkstationName());
>>      }
>>                      
>>      broker.commitTransaction();
>>} catch (Throwable t) {
>>      broker.abortTransaction();
>>      t.printStackTrace();
>>}
>>
>>But it doesn't work (ClassCastException)!
>>My question is: which object the getReportQueryIteratorByQuery 
>>method returns?
>>In this case it seems that it isn't a Workstation object.
>>
>>Could you help me?
>>
>>Thanks
>>Sylvain
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>
>
>This email and any attachments are strictly confidential and 
>are intended
>solely for the addressee. If you are not the intended 
>recipient you must
>not disclose, forward, copy or take any action in reliance on 
>this message
>or its attachments. If you have received this email in error 
>please notify
>the sender as soon as possible and delete it from your 
>computer systems.
>Any views or opinions presented are solely those of the author 
>and do not
>necessarily reflect those of HPD Software Limited or its affiliates.
>
> At present the integrity of email across the internet cannot 
>be guaranteed
>and messages sent via this medium are potentially at risk.  
>All liability
>is excluded to the extent permitted by law for any claims 
>arising as a re-
>sult of the use of this medium to transmit information by or to 
>HPD Software Limited or its affiliates.
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>


This email and any attachments are strictly confidential and are intended
solely for the addressee. If you are not the intended recipient you must
not disclose, forward, copy or take any action in reliance on this message
or its attachments. If you have received this email in error please notify
the sender as soon as possible and delete it from your computer systems.
Any views or opinions presented are solely those of the author and do not
necessarily reflect those of HPD Software Limited or its affiliates.

 At present the integrity of email across the internet cannot be guaranteed
and messages sent via this medium are potentially at risk.  All liability
is excluded to the extent permitted by law for any claims arising as a re-
sult of the use of this medium to transmit information by or to 
HPD Software Limited or its affiliates.



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


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

Reply via email to