• Post Reply Bookmark Topic Watch Topic
  • New Topic

possible error in Ed Roman's Mastering EJB (2nd Edition)

 
Edy Yu
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On page 150, in the ejbLoad() code, the primary key field was not loaded...
Do I miss anything?
 
aaron chang
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
there's no parameter passing in ejbLoad(). plz read p149-p150 of the book:
public void ejbLoad() {
System.out.println("ejbLoad() called.");
/* Again, query the Entity Context to get the current Primary Key, so we know which instance to load.*/
AccountPK pk = (AccountPK) ctx.getPrimaryKey();
String id = pk.accountID;
...

it's clear.
 
Dave Cronin
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is an erratum that was listed at http://www.theserverside.com/books/masteringEJB/index.jsp
The primary should be set to the member variable "accountID", not to a local variable "String id".
I think you have to be careful reading technical books since errors can slip in such books very easily.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!