| Author |
multiple-entity finder method return type
|
Keith Rosenfield
Ranch Hand
Joined: Nov 25, 2003
Posts: 277
|
|
Hi All: Does the return type of a multiple-entity finder method have to be Collection or can it also be Set?
|
Keith Rosenfield<br />SCJP<br />SCWCD<br />SCBCD
|
 |
Marcos Maia
Ranch Hand
Joined: Jan 06, 2001
Posts: 977
|
|
It can also be a Set, see chapter 11 of ejb2.0 specs. regards.
|
 |
Marcos Maia
Ranch Hand
Joined: Jan 06, 2001
Posts: 977
|
|
also notice: from spec: 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. regards.
|
 |
Keith Rosenfield
Ranch Hand
Joined: Nov 25, 2003
Posts: 277
|
|
Hi Marcos,
Originally posted by Marcos Maia: It can also be a Set, see chapter 11 of ejb2.0 specs.
Are you sure this is the case? I looked through chapter 11, but could not find anything that would suggest this. Besides, I found the following sentence from 10.5.6.2 of the spec
The Bean Provider uses the Java� 2 java.util.Collection interface to define a collection typefor the result type of a finder method for an entity bean with container-managed persistence.
If you are certain that Set can be used as well, please point to the exact page of the spec that states that. Thanks for you efforts. [ February 03, 2004: Message edited by: Keith Rosenfield ]
|
 |
Marcos Maia
Ranch Hand
Joined: Jan 06, 2001
Posts: 977
|
|
Hi, read the topic 11.2.8 from the specification - SELECT clause. But I was researching and reading topics 10.5.6 and 10.5.7 I get to think that Set could only be used for ejbSelect methods??? I think specs are not that clear about this point, because as far as u can use DISTINCT for multi-object finders, what's the problem of returning a Set then??? regards.
|
 |
Keith Rosenfield
Ranch Hand
Joined: Nov 25, 2003
Posts: 277
|
|
Hi Marcos, Are we in agreement now that java.ejb.Collection must be the return type of a multi-entity finder method?
Originally posted by Marcos Maia: I think specs are not that clear about this point, because as far as u can use DISTINCT for multi-object finders, what's the problem of returning a Set then???
I don't know what the problem is with returning a set. Can anyone shed some light on this??? Thanks.
|
 |
Marcos Maia
Ranch Hand
Joined: Jan 06, 2001
Posts: 977
|
|
Originally posted by Keith Rosenfield: Hi Marcos, Are we in agreement now that java.ejb.Collection must be the return type of a multi-entity finder method? I don't know what the problem is with returning a set. Can anyone shed some light on this??? Thanks.
Yes, I agree, but really don't like to don't know the how's about things. I'd love some light on this also. regards.
|
 |
 |
|
|
subject: multiple-entity finder method return type
|
|
|