Since a student can enroll in many courses so Student has probably a CMR collection relation with courses. Pg 233 of Spec says that the "SELECT clause must be specified to return a single-valued expression" So the above query is wrong. The correct query will be select Object(c) from students s, IN(s.courses)c
hey Sudhir I have a question for you on this query? don't you need to see the deployment descriptor for the bean , to know whether Student bean is in CMR or not...and if the bean is not in CMR ,there should not be any error right? >because sonali said there was an error you tried to write a proper query with CMR right? please help
Failure is not when you fall down; its only when you fail to get up again.
Hi Sudhir I had a question about the correct query posted by u . select Object(c) from students s, IN(s.courses)c In the above , which course object would be returned as a result of the query ?? With a Where clause to the above query it would make sense to return a specific course object but without a Where clause will the above return the entire courses collection ??? - Keith
Sudhir In the above scenario lets say student s1 has enrolled in courses c1,c2 student s2 has enrolled in courses c1 student s3 has not enrolled at all so without DISTINCT will it return c1,c2 and c1 and with DISTINCT clause will it return just c1 and c2 ?? Does it also mean that if the collection is empty it will automatically be not included in the results ? - Keith