• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ques from mock exam

 
Giju George
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which of the following methods must be implemented by an entity bean class with Container managed persistence?


Options

Select 1 correct option.

1. At least one ejbCreate(...)

2. ejbFindByPrimaryKey(...)


3. At least one ejbSelect(...)


4. At least one ejbFindByXXX(...) (other than ejbFindByPrimaryey(...))


5. None of these.

The correct answer mentioned in the mock exam was "5".

But isn't it option 2 (ejbFindByPrimaryKey(...) ) correct ???
 
Giju George
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
folks... got the answer.
In the spec it says,

An entity bean�s home interface defines one or more finder methods[16]

And ejbFindByPrimaryKey is NOT declared in the entity bean class. It's done by the container. I mistook home interface for entity bean class.

So, now I know that I should read the ques twice...
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, the ejbFindByPrimaryKey() method must be implemented by the container when it generates the concrete (container-specific) entity bean class. The bean provider must not declare such a method in his abstract entity bean class as mentioned in section 10.7.2 of the EJB 2.0 spec.


The entity bean class does not implement the finder methods. The implementations of the finder methods are provided by the container.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic