Win a copy of Practice Tests for OCP Java 17 Certification Exam (1Z0-829) this week in the OCPJP forum!
  • 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

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 ]
 
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