Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Developing EJB 2.0 Components by Tulachan  RSS feed

 
T Rob Darrough
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
T Rob Darrough
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Narrowing should always be safe, but it shouldn't always be necessary.

Kyle
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!