• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

some doubts on mock exam questions

 
reubin haz
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is a question from ejbCertificate.com

Which of the following statements are correct about the responsibilities of the EJB container?
1.When the container invokes the ejbRemove() method the container removes immediately the entity from the database.
2.The container synchronizes the instance's state before it invokes the ejbRemove() method and uses the ejbLoad() method.
3.The container is responsible for providing the implementation of the ejbFind() methods.
4.After the ejbHome() method completes, the instance remains in the ready state.
5.he container is responsible for calling the ejbCreate() method.

The correct answer is 2,3,5. I did not choose 2 because I think there is no point to update entity bean from the underline database since it's about to be deleted. No matter the entity bean's data is updated or stale, its about to be delete, why bother to update it before its about to be deleted? Am I right?



Another question from Whizlabs:

____ is the method that must always be declared in the (local or remote)home interface of an entity bean. (write only the method name)

I wrote: remove
but the answer is findByPrimaryKey. Isn't this answer should apply to component interface instead of home interface? Please someone judge my answer.

Is this correct:
ejbFindByPrimaryKey and other ejbFind methods return primary key?
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Regarding the first question, option 2 is correct. Please see section 10.5.3 of the EJB specification for confirmation.

As for the Whizlabs question, the given answer is correct. Please refer to sections 9.5.2 and 9.6.2 of the EJB specification.

Regarding your last question, the ejbFind methods in the entity bean class, they always return the primary key or a collection thereof. See section 10.7.3 of the EJB specification.
[ March 12, 2006: Message edited by: Valentin Crettaz ]
 
reubin haz
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.

But for the method declared in the both local and remote home interface also have: remove(Object pk), isn't this also right?
 
Muthaiah Ramanathan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
remove(Object pk) - Is not actually declared by the Home Interface, but by its super interface. But it does declare the findByPrimaryKey.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic