Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

HF EJB - Being an entity bean

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm looking into the chapter "Being an entity bean" at this moment from the K&B Head First EJb book.
I was trying to find out what "things" I was able to do when an entity is being created.
According to the book on p.338 the reference to your EJB Object cannot be obtained because the actual entity has not been created. Rightly.
However at the end of this chapter, in question 9 one of the correct answers is getEJBObject().
Am I overlooking something or has something been overlooked?
[ November 17, 2003: Message edited by: Dixie Bickham ]
Cowgirl and Author
Posts: 1589
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You didn't miss anything! This is an error in the book that, who knows how, made it past a gazillion reviewers. And it's a Big Error. The answer is incorrect, the stuff on page 338 IS correct. You cannot get a reference to your EJB object from within ejbCreate() (the reason is explained on page 338, as you saw) -- it's too early, because the Container is still waiting for YOU to return from that the Container needs to build (at least conceptually) the EJB object.
I think that qualifies you to be listed in the next printing of the book as a "brave early adopter". So if you write to me directly and tell me what name to put in the book, the next printing will probably happen in a few weeks!
    Bookmark Topic Watch Topic
  • New Topic