Hi Alexey,

sorry, we missed the mapping of the relation for class Vehicle, we only did it for Tour.

Thanks a lot,
michael

At 17:04 02.07.2003 +0400, you wrote:
So, it look simple:
class Vehicle {
  // Vehicles tours collection
  private ArrayList tours = new ArrayList();
  ...
}

class Tour {
  // Tour vehicles
  private ArrayList vehicles = new ArrayList();
  ...
}

You must create their classes and just load vehicle what you need:
SELECT o FROM Vehicle o WHERE id = $1

Then list of tours you can get by loaded vehicle.getTours();

Thanks!

-----Original Message-----
From: michael simons [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 02, 2003 4:55 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] in- or contains-operator


No, because Tour (N:M) Vehicle A Tour is driven by one or more vehicles (e.g. truck and trailer) A Vehicle drives more than one Tour. The query should give all Tours, that are driven by the Vehicle upon others. That's why I don't see any alternative to the in operator except something like retrieve all Tours (OQL) walk through that list and collect all Tours that contain the Vehicle in the list returned by their getVehicles() method.

BTW That's why I guessed it might possible to use contain in the OQL
directly.

Regards,
michael


At 16:27 02.07.2003 +0400, you wrote: >Ok, in your case you not need to use LIST IN operator, I guess: SELECT >o FROM TOUR o WHERE o.vehicle = $1 > >Somethink like that > >Thanks > >-----Original Message----- >From: michael simons [mailto:[EMAIL PROTECTED] >Sent: Wednesday, July 02, 2003 4:24 PM >To: [EMAIL PROTECTED] >Subject: Re: [castor-dev] in- or contains-operator > > >Hello Alexey, > >A list like the ones you showed would get rather large. I must assume >about 100 000 Tour instances that might be driven by the given vehicle,

>but I think I have to give it a try.
>
>The contains operator was just a shot in the dark by me.
>
>thanks,
>michael
>
>
>At 16:07 02.07.2003 +0400, you wrote:
> >Hi,
> >
> >1. IN LIST operator support syntax like:
> >
> >select o from Object o where id in list(1, 2, 3, 4), if values is
> >numeric and select o from Object o where id in list("1", "2", "3",
> >"4"), if values is stringable To perform automatical list OQL
> >generation I use my framework
> >(http://sourceforge.net/projects/phantom-castor/) it have
> >OQLPreparator for it. For example:
> >
> >List idList = new ArrayList();
> >idList.add("1");
> >idList.add("2");
> >idList.add("3");
> >String oql = OQLPreparator.prepareOQL(
> >   new Select(A.class),
> >   new WhereInList("id", idList)
> >);
> >
> >The result will be:
> >SELECT o FROM package.to.class.A o WHERE id IN LIST("1", "2", "3")
> >
> >2. What is "contains" operator? I don't know it... Are you sure that
> >it
>
> >is avable now? http://www.castor.org/oql.html#Syntax
> >
> >Thanks!
> >
> >
> >-----Original Message-----
> >From: michael simons [mailto:[EMAIL PROTECTED]
> >Sent: Wednesday, July 02, 2003 3:53 PM
> >To: [EMAIL PROTECTED]
> >Subject: [castor-dev] in- or contains-operator
> >
> >
> >Hi all,
> >
> >I want to do a query like the following
> >
> >query = db.getOQLQuery("select t from Tour where $1 in
> >LIST(t.vehicles)"); query.bind(aVehicle);
> >
> >or
> >
> >query = db.getOQLQuery("select t from Tour where t.vehicles
> >contains($1)"); query.bind(aVehicle);
> >
> >Does anybody know how to do this (both my attempts lead to
> >exceptions)?
> >
> >Regards,
> >michael
> >
> >-----------------------------------------------------------
> >If you wish to unsubscribe from this mailing, send mail to
> >[EMAIL PROTECTED] with a subject of:
> >         unsubscribe castor-dev
> >
> >-----------------------------------------------------------
> >If you wish to unsubscribe from this mailing, send mail to
> >[EMAIL PROTECTED] with a subject of:
> >         unsubscribe castor-dev
>
>-----------------------------------------------------------
>If you wish to unsubscribe from this mailing, send mail to
>[EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev
>
>-----------------------------------------------------------
>If you wish to unsubscribe from this mailing, send mail to
>[EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev

-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev




Reply via email to