Forums Register Login

Developing EJB 2.0 Components by Tulachan

+Pie Number of slices to send: Send
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?

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?

Pg 217: The whole page is subtitled "Rules for Implementing ejbFinder Methods". I thought the container implemented finder methods?

Pg 217: It states that you have to narrow the results of a finder method.

Pg 217: It states in two different places that finder methods return primary keys. I thought they returned an instance of the remote component?
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
Hi,

You said "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." which leads me to the question, is there ever a case where you should definately not narrow or is narrowing always safe?
+Pie Number of slices to send: Send
Narrowing should always be safe, but it shouldn't always be necessary.

Kyle
Not so fast naughty spawn! I want you to know about
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 605 times.
Similar Threads
findByPrimaryKey
Please tell I'm doing something wrong and ejbs don't suck that much
Understandly entities ejb life-cicle deeply... need some help.
HFEJB questions 18 on page 371
Mark Cade's Study Guide p. 28 Q13: Benefit using DAO with BMP Entity Bean
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 08:03:15.