Originally posted by B Sathish: would be the same as
I'd prefer produces the same result as - because they are certainly not the same. Never use DISTINCT if you know that your results will be unique anyway. DISTINCT will inject the DISTINCT keyword into the SQL query which means that the RDBMS will waste time to try to eliminate duplicates - and depending on the size of the result set that could be a considerable amount of time.
However SELECT DISTINCT OBJECT (m) is necessary with a more complicated (Finder Query) where the same object may appear more than once according the criteria specified by the WHERE clause (and you don't care for looking at the same entity twice) as in:
based on the table on page 400 in HFEJB Movie 12 would bring up director 42 once as would Movie 11, so DISTINCT would eliminate the second reference to the Director 42 object. So
would not produce the same results. [ October 28, 2005: Message edited by: Peer Reynders ]