• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ejbSelect: zero or more OR one or more???

 
Boniface Kabaso
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,
On page 174 of the EJB 2.0 spec, it says that the Bean provider defines zero or more ejbSelect methods. Further down on page 193, it says again that the Bean provider defines one or more ejbSelect methods.
I have come across questions asking me to choose between the two. What really is the correct statement..p.174 or p.193

Boniface
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Boniface,
Nice shot !
It's zero or more as stated on p 174 IMO. "one or more select methods" on p. 193 would then be a mistake.
ejbSelect methods are optional. I don't see any ejbSelect method which would be mandatory.
Would be nice if somebody could confirm this.
Best,
Phil.
 
Mikalai Zaikin
Ranch Hand
Posts: 3371
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy, guys
"select" methods are optional.
only "findByPrimaryKey" method is a must among select and find methods for Entyty EJB.
but please, read once again, spec p.193 says :
The entity bean class may define one or more select methods

"MAY DEFINE", is not equal "DEFINES"
I can say:

A man may get married one or more times in his life.

(He/she may never married at all. Sounds sad, but it could be... )
But this NOT the same, that :
A man always get married one or more times in his life.

This is not true. Marriage is not a mandatory
Cheers!
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mikalai,
Good point ! "may ... one or more" may obviously (but you had to catch it, thanks !) be translated in "must ... zero or more".
We got the confirmation we were waiting for !
Thanks,
Phil.
 
Rashmi Tambe
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Boniface Nsung'u:

On page 174 of the EJB 2.0 spec, it says that the Bean provider defines zero or more ejbSelect methods.

This applies for entity beans which can have no select method defined. However finder method, [b] findByPrimaryKey[b] is mandatory.

Further down on page 193, it says again that the Bean provider defines one or more ejbSelect methods.

This applies for session beans which can must define atleast one select method.
Correct me if i am wrong.
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think, ejbSelect methods are applicable only to Entity beans both CMP and BMP and are purely optional, as mentioned in the above posts. In the spec, both statements on the different pages are related to Entity beans.(the whole chapter is on Entity beans).
I do not know why the author choose "zero or more" and "one or more" style, but I guess, the chapter may have been written by 2 different authors
 
Boniface Kabaso
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,
Yes Vish is right. The section of the spec I quoted is related to EB. I think the Mikalai explanation is logical and rightly leads to zero or more. I still feel the "one or more" version shouldn't have been in the spec.. abit misleading ..thought these specs go through the JCP
Anyway, thanks folks for your input.
--------
Boniface
 
Rashmi Tambe
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, i messed up with this!
what ever i wrote was right for ejbCreate() and not ejbSelect()...i am sorry for the confusion...i think i need a good break !
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic