• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

multiple-entity finder method return type

 
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All:

Does the return type of a multiple-entity finder method have to be Collection or can it also be Set?
 
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It can also be a Set, see chapter 11 of ejb2.0 specs.
regards.
 
Marcos Maia
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 977
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 977
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic