• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HF questions - page 316

 
Keith Rosenfield
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I noticed that the ejbCreate method calls the abstract version of all the setters except for setAddress. Why is that?
Also, what is the meaning of the null return value? I suppose the answer to this question will be revealed as I continue my reading.
 
Keith Rosenfield
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One more question pertaining to the same code. Why is ejbPostCreate not included? Isn't it necessary?
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Keith,
I noticed that the ejbCreate method calls the abstract version of all the setters except for setAddress. Why is that?

In my copy of the book, setAddress() is called (the line just before "return null").
Also, what is the meaning of the null return value? I suppose the answer to this question will be revealed as I continue my reading.

I may tell you it will be hard to find the answer in the book !
It comes from the specs themselves : BMP entity beans must return the primary key from ebjCreate(), while CMP beans must return null. Just think of the fact that with CMP beans the container knows which field(s) make the primary key.
Best,
Phil.
[ December 05, 2003: Message edited by: Philippe Maquet ]
 
Keith Rosenfield
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Phillip,
The method call setAddress is in my book too. My question is why was setAddress called instead of setCustomerAddress. setCustomerAddress is the abstract method and setAddress is the concrete method. All the other method calls in ejbCreate were to the abstract methods(setLast for example not setLastName). Is this inconsistency by plan or an oversight?
[ December 05, 2003: Message edited by: Keith Rosenfield ]
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Keith,
The method call setAddress is in my book too. My question is why was setAddress called instead of setCustomerAddress. setCustomerAddress is the abstract method and setAddress is the concrete method. All the other method calls in ejbCreate were to the abstract methods(setLast for example not setLastName). Is this inconsistency by plan or an oversight?

OK, I now understand your question. I don't think it was done on purpose, but ... the result should the same anyway, right ?
BTW, I forgot to answer your next question :
One more question pertaining to the same code. Why is ejbPostCreate not included? Isn't it necessary?

It's just a code excerpt (look at the last comment in the class). There are other mandatory methods missing...
Best,
Phil.
 
Keith Rosenfield
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Phillipe,(sorry that I forgot the e on previous post)
Assuming it was not on purpose. Is there a reason to choose the abstract version of accessors vs. the non-abstract version or are both equally acceptable.
ejbPostCreate is also missing from the code on page 318-319 which claims to be the "complete code". Isn't it mandatory in that case.
[ December 05, 2003: Message edited by: Keith Rosenfield ]
[ December 05, 2003: Message edited by: Keith Rosenfield ]
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Keith,
or are both equally acceptable

Both are equally acceptable (if you except the *very little overhead* of the call to the non-abstract version (which in turn calls the abstract one ) ).
ejbPostCreate is also missing from the code on page 318-319 which claims to be the "complete code". Isn't it mandatory in that case.

It's a mistake in this case.
Best,
Phil.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic