From: Ilya V Lipkind Thank you Tomas for help. I just want to double check, that I understand it correctly : Currently parser be able to parse only query against one object. ;-( The problem is not the parser, the problem is nature of OQL language, it's OBJECT query language, so as result it return list of single Object Result Set, not a JOIN of different tables like SQL. So it would be hard to map SQL JOIN result to JDO. I guess, this is source of the problem. Please, let me know if I'm wrong. Ilya Date: Tue, 18 Sep 2001 15:43:15 -0700 From: "Thomas Yip" <[EMAIL PROTECTED]> Subject: RE: [castor-dev] OQL to SQL translation ... >Hi Illya, > > > > In theory, the parser generated the right SQL. > > The OQL you want should actually look like that: > > SELECT st FROM StudySeriesOnly st, st.series ser > WHERE st.studyID = $1 AND > ( ser.seriesModality = $2 AND ser.seriesNumer = $ 3 ) > >However, the current implementation of the parser probably does not able to >take the right OQL. > > > >Thomas -----Original Message----- >From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] >Sent: Friday, September 14, 2001 2:32 PM >To: [EMAIL PROTECTED] >Subject: [castor-dev] OQL to SQL translation ... > >From: Ilya V Lipkind > >I have two objects with 1-n relationship : Study has list of series. >For OQL query like : > SELECT st FROM clinicaldb.StudySeriesOnly st WHERE studyID = $1 AND > (st.series.seriesModality = $2 AND > st.series.seriesNumber = $3) > > >got translated to SQL like : > >SELECT "STUDY".*, "GENRAL_SERIES".* >FROM "GENERAL_SERIES" "GENERAL_SERIES_1", > "GENERAL_SERIES" "GENERAL_SERIES_0", > "GENERAL_SERIES","STUDY" >WHERE "STUDY"."SID"="GENERAL_SERIES"."STUDY_SID"(+) AND > "STUDY"."SID"="GENERAL_SERIES_0"."STUDY_SID" AND > "STUDY"."SID"="GENERAL_SERIES_1"."STUDY_SID" AND > ("STUDY"."STUDY_ID" = '13313' AND > "GENERAL_SERIES_0"."MODALITY" = 'CT' AND > "GENERAL_SERIES_1"."SERIES_NUMBER" = 2) >FOR UPDATE > >Please, note, that there is two aliases for a child object. So , this query >mean in plain English : "Give me all the studies with relevant series, >where study ID is 13313 and at least one series modality is CT OR series >number equal to 2. Basically, it return union of related studies. > >My expectation for SQL was different : > >SELECT "STUDY".*, "GENRAL_SERIES".* >FROM "GENERAL_SERIES","STUDY" >WHERE "STUDY"."SID"="GENERAL_SERIES"."STUDY_SID"(+) AND > ("STUDY"."STUDY_ID" = '13313' AND > "GENERAL_SERIES"."MODALITY" = 'CT' AND > "GENERAL_SERIES"."SERIES_NUMBER" = 2) >FOR UPDATE > >This query will return intersection of requested data and not a union. Any >help and experience, how can I specify the query on the child object of 1-n >relationship would be highly appreciate. >Also, if somebody can post list of OQL queries against objects, that have >different relationships. It's hard to define the queries only based on a >grammar and hope, that parser will accept it. > >Ilya. > >----------------------------------------------------------- >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
