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]
