I have skimmed through the spec and I think the spec only mentions about the two scenarios: 1. If the return type is Collection and DISTINCT is not specified ... 2. If the return type is Set and DISTINCT is not specified ...
I didn't come across a scenario in spec which says about "when DISTINCT is used and return type is Collection...".
I think in this scenario, we should get Collection ("set like") as the returned value. But, it *may* depend on container implementation.
Frederic, if you are going to implement Entity Bean code, can you also try this scenario in the bean code and then confirm what result do you see?
---------- page 233 If the EJB QL query is specified for a method whose return type is java.util.Collection , the collection of values returned by the Container may contain duplicates if DISTINCT is not specified in the SELECT clause. If the query is specified for a method whose result type is java.util.Set, but does not specify DISTINCT, the container must interpret the query as if SELECT DISTINCT had been specified. ------------ ofcourse if u have distinct in a collection type result... the result will be the same as that of set.
Frederic Esnault since u are watching this thread... is it necessry for the primary key class(compound key example on you site) to have the getters and setters in addition to the getters and setters in the bean class. thanks [ June 29, 2006: Message edited by: Srividhya Anand ]