Hi Bin,I think it's confusing to project a collection or map in a query. The reason is that if there is a variable that derives from the same field as is being projected, the user might think that the field will be subject to the same constraints as the query, but this would be wrong.
I'd rather we restrict projections of collection and map in queries. We can always add it later once we think more about whether it makes sense and has a strong justification.
What can the user not do today if we restrict projection of collections and maps? If the user really wants to navigate to the collection or map field, then just project the instance and navigate to the fields of interest.
Craig On Feb 13, 2006, at 6:27 PM, Bin Sun wrote:
Hi, all! Did anyone notice this? --- Bin Sun <[EMAIL PROTECTED]> wrote:Hi! I have more concern about Collection and Map projection: is this query easy to implement? select distinct employees from Department where ... At least I don't know how a SQL datastore could compare the collections one another. So, maybe we should discribe more on Collection and Map projection, or simply specify that their distinction is the same as their owner objects, dispite whether they equal one another. --- [EMAIL PROTECTED] wrote:Thanks for the comments, I agree with you all. Regards, Quoting Michael Bouschen <[EMAIL PROTECTED]>:Hi, I have the same understanding of the semanticsofprojections ofcollection and map fields as Wes and Bin Sun.Thequery would return thecollections or maps as single cells, so thequeryresult would be a listof collections or maps. I also agree thatsupportfor projections ofcollection and map fields does not add muchvalue,but AFAIK the currentspec allows this. I think the shape of the query result isdifferentwhether projecting acollection field or including a variable in theresult that iterates thecollection: (1) SELECT employees FROM Department (2) SELECT e FROM Department WHEREemployees.contains(e)The first query returns a list of collections ofemployees, so for eachdepartment it returns the department's employeecollection. Query (2)returns a list of employees, where each returnedemployee is included inan employee collection of at least onedepartment.Given the above is correct, JDOQL would neverreturn Map.Entryinstances. Either the query projects the entiremap or it iterates themap using containsKey or containsValue, butthereis no contains for maps.Regards MichaelHi, all! If I didn't miss anything in the spec, Iwouldexpect 'single-cell' result for a collectionormapfield, as if it is a simple field or referencefield.eg. "select employees from Department" --> [employees of Dept 1] [employees of Dept 2] [employees of Dept 3] ... Assume Student.scores: Map<Course, Float> "select name, scores from Student" --> aaa,[scores map for aaa] bbb,[scores map for bbb] ccc,[scores map for ccc] --- [EMAIL PROTECTED] wrote:Actually, you can project a collection field,but infact what is projected are the elements of the collection. dept = {"dept1","dept2"} dept1.employees = {"emp1","emp2","emp3"} dept2.employees = {"emp4","emp5"} "select employees from Department" will resultinemp1 emp2 emp3 emp4 emp5 "select this, employees from Department" willresultin dept1, emp1 dept1, emp2 dept1, emp3 dept2, emp4 dept2, emp5 I would like to know what would that be incaseofMap or arrays. Quoting Wes Biggs <[EMAIL PROTECTED]>:It doesn't make much sense to me to projecttomapor collection fields,though I don't see it explicitly discussed inthespec. I suppose if weallowed it, the cell would be of type Map orCollection (or etc. asdeclared). Or am I missing some kind ofautomaticflattening function?i.e., today can you do: "select employees from Department" (returnscellsof type Collection)?Perhaps I'm confusing the issue. Wes [EMAIL PROTECTED] wrote:Thanks Craig. If a map is projected, do we have two cells(key,value) or one cell withtypeMap.Entry ? I would expect it to be Map.Entry, what isinthespec?__________________________________________________Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spamprotection aroundhttp://mail.yahoo.com=== message truncated === __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Craig Russell Architect, Sun Java Enterprise System http://java.sun.com/products/jdo 408 276-5638 mailto:[EMAIL PROTECTED] P.S. A good JDO? O, Gasp!
smime.p7s
Description: S/MIME cryptographic signature
