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 ol...@ppi.de on 2002/12/05 08:26:15 UTC
OQL syntax, was: RE: OJB
Hello,
> -----Original Message-----
> From: Thomas Mahler [mailto:thma@apache.org]
>
> POET (www.poet.com)
I am new to OJB, but I know about Poet (or rather: FastObjects,
as the product is called now).
> > OJB - the best example is this from the provided link
> >
> > SELECT x FROM persons x WHERE x.name = "Pat"
> >
> > OJB OQL does not support the aliasing (persons x) so the
> above has to be
> > written as
> >
> > SELECT x FROM persons WHERE name = "Pat"
> >
In FastObjects-OQL syntax, this can be written as:
SELECT x FROM personsExtent AS X WHERE x.name = "Pat"
You can also do things like:
SELECT x.spouse.name FROM personsExtent AS X WHERE x.name = "Pat"
to get the names of people married to a "Pat". (In case
of FastObjects as a String-array, not a DCollection)
Can you do this in OJB-OQL, too?
Apart from the OQL-syntax, I agree that Poet has a fairly
standard compliant API and documentation.
Oliver
--
Dr. Oliver Matz
ppi Media GmbH
Deliusstraße 10
D-24114 Kiel
phone +49 (0) 43 1-53 53-422
fax +49 (0) 43 1-53 53-2 22
email mailto:oliver.matz@ppi.de
web www.ppi.de
Re: OQL syntax, was: RE: OJB
Posted by "J. Russell Smyth" <dr...@cox.net>.
>
> SELECT x.spouse.name FROM personsExtent AS X WHERE x.name = "Pat"
>
> to get the names of people married to a "Pat". (In case
> of FastObjects as a String-array, not a DCollection)
>
> Can you do this in OJB-OQL, too?
you should be able to do this as:
SELECT x.spouse.name FROM personsExtent WHERE name = "Pat"
but I will not guarantee it! One thing our experience has shown us
is that since OJB-OQL does not provide aliases (person x - x in person -
pserson as x) something funny happens - if OJB recongnizes x.spouse.name
as attributes on person objects, then all will be ok. However, if not,
it will treat the whole x.spouse.name as a single string (like "select
obj from persons where...") and will return the objects you query, not
the requested property.
>
> Apart from the OQL-syntax, I agree that Poet has a fairly
> standard compliant API and documentation.
>
> Oliver
>
> --
> Dr. Oliver Matz
> ppi Media GmbH
> Deliusstraße 10
> D-24114 Kiel
> phone +49 (0) 43 1-53 53-422
> fax +49 (0) 43 1-53 53-2 22
> email mailto:oliver.matz@ppi.de
> web www.ppi.de
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
addGroupBy - Please help me!!!!!!!!!
Posted by Dhamodharan P <dh...@yahoo.co.uk>.
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