Bruce Snyder a écrit :
> 
> Philip DONAGHY wrote:
> 
> > I'm just throwing this out there because I could really use a join
> > syntax in Castor JDO. I would like to keep the select as a simple object
> > but the from and where clauses would look something like this.
> >
> > SELECT Org
> >
> > FROM db.finaixm.OrgAuth Org,
> >      db.finaixm.OrgAuthM OrgM
> >
> > WHERE Org.oamOrgAuthMId = OrgM.orgAuthMId AND
> >       Org.txtName=$1
> 
> Philip,
> 
> This can be achieved through th euse of a correctly written mapping
> descriptor. The odd part is that the OQL query will *not* contain an
> explicit join because Castor's OQL engine will create the query behind
> the scenes. Are you not able to achieve this? Please elaborate further.
> 
> Bruce

The difficulty with this can be explained by presenting our schema which
supports temporality. Each entity can have several versions (changes to
airport data has to be traceable). For each moment in time there can be
one and only one valid version. Therefore for each entity there are two
tables. A version table which contains the data, a pk (primary key), one
or more fk (foreign keys), and the date meta data (dateStart, dateEnd,
dateCancelled). A master table represents all the versions a pk column
only. Therefore you have the following relationships.

Ahp.pk
Ahp.codeId
Ahp.fk---> AhpM.pk
               /\
               ||
               Aho.AhpMfk
               Aho.fk --------> AhoM.pk
               Aho.ObsMfk
               ||
               \/
Obs.fk--> ObsM.pk
Obs.geoLat
Obs.geoLong

This schema shows 6 tables AirportObstacle (Aho), AirportObstacleM
(AhoM), Obstacle (Obs), ObstacleM (ObsM), Airport (Ahp), AirportM
(AhpM). The sql query required is :

select * from Aho, AhoM, 
              Obs, ObsM, 
              Ahp, AhpM 
where Aho.Ahpfk = AhpM.pk and Ahp.fk = AhpM.pk and Ahp.codeId = ?
      Aho.Obsfk = ObsM.pk and Obs.fk = ObsM.pk and Obs.geoLat = ? and
Obs.geoLong = ?

In oql

select Aho from Aho where Aho.AhoM.pk = Aho.fk and
Aho.AhpM.AhpCollection.contains(Ahp where Ahp.codeId = $1) and
Obs.ObsM.ObsCollection.contains(Obs where Obs.geoLat = $2 and
Obs.geoLong = $3)

Is this kind of Mapping possible?

The oql implementation in Castor just translates to SQL. So why not
implement joins.

Sincerely,

Phil

> --
> perl -e 'print
> unpack("u30","<0G)[EMAIL PROTECTED]&5R\\"F9E<G)E=\\$\\!F<FEI+F-O;0\\`\\`");'
> 
> The Castor Project
> http://www.castor.org/
> 
> Apache Geronimo
> http://incubator.apache.org/projects/geronimo.html
> 
> -----------------------------------------------------------
> 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