Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Developing EJB 2.0 Components by Tulachan

 
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?
 
author
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
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
 
I RELEASE YOU! (for now .... ) Feel free to peruse this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic