Some answers in the text.
Originally posted by T Rob Darrough:
Hi,
I am reading "Developing EJB 2.0 Components" by Tulachan and have came across some things I that seem to be false. (Of course, if I knew enough about EJB to know if these things are false I would have no need to read the book.) I was hoping someone could set me straight.
Also, what's the best place(s) for someone who has never written or worked with EJBs to learn how?
Experience is the best teacher. Download a container and try it...
Pg 213: "the ejbLoad() method contains the necessary SQL SELECT command and the logic to read and translate the persistent data from the database". I thought ejbLoad was called after the data was loaded?
The statement is correct for BMP beans. You are correct for CMP beans.
Pg 217: The whole page is subtitled "Rules for Implementing ejbFinder Methods". I thought the container implemented finder methods?
You implement the ejbFindBy... methods in a BMP. In a CMP you provide the EJB-QL and the container implements the rest.
Pg 217: It states that you have to narrow the results of a finder method.
It's not required in all cases, but it's often a best practice, especially when you're getting results back out of a Collection. It's one of the cases where the spec's a tiny bit fuzzy and vendors interpret the sample code in the spec differently.
Pg 217: It states in two different places that finder methods return primary keys. I thought they returned an instance of the remote component?
BMP ejbFindBy... methods do return primary keys. CMP and BMP Home finder methos return instances of the components.
Hope this helps.
Kyle