• 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:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

head first EJB question

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is qustion in head first EJB p362, No.1
When implementing a one-tomany relationship, the java/util.List interface not be used.
the answer: "Only Collection or Set can be used".
My question, the List IS a collection.
Set and List both implement or extends Conllection interface.
 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
True,
But the EJB 2.0 spec, page 130, footnote 10 says:


We expect to include java.util.List and java.util.Map in a later version of this specification.


So, not yet, and it's not in the 1.4 spec either. Perhaps it has something to do with Lists allowing duplicate entries (and lots and lots of nulls) but Sets must have at most one null and no duplicates.
-=david=-
[ January 10, 2004: Message edited by: David Harrigan ]
 
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Bin:
Keep in mind that, when using container-managed persistance, the entity bean class is abstract and that the container will create the implementation class. The container is free to use any Collection or Set type of its choosing for the implementation's finder and select methods' return values. If you declare the return type to be java.util.List you will be restricting the Collection type that the container can choose, so therefore it is not permitted.
Entity beans using bean-managed persistance do not have such a restriction.
Hope this helps.
[ January 10, 2004: Message edited by: Keith Rosenfield ]
 
The only thing that kept the leeches off of me was this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic