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