The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

java_on_fire (6) [Avatar] Offline
#1
Hi all,
I would like understand why are we invoking the interface PlaceBid.addBid(bid) in the PlaceBidServlet instead of PlaceBidBean.addBid(bid)? The interface addBid has no definition but somehow uses the PlaceBidBean addBid but how?

Thanks,
reza_rahman (456) [Avatar] Offline
#2
Re: Chapter 2 P.46 Using stateless beans
As Chapter 2 alludes, the @EJB annotation will inject a PlaceBidBean instance since it implements the PlaceBid interface specified at the injection point. The details of dependency injection via @EJB and @Resource is outlined in Chapters 3 and 5.

BTW, for basic/generic questions, I highly recommend the JavaRanch EJB forums: http://www.coderanch.com/forums/f-11/EJB-JEE. You'll find that there are more folks around there to answer questions and have lively discussion smilie.

Cheers,
Reza