Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

BMP Entity Bean

 
Vishnu Munnangi
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,
Please go thru this question.

Can anybody pl explain how A and B are correct ? The reason would be helpfull.

Thanks


Q) An application uses BMP to manage the persistence of Customer and Address entity beans. Customers must have exactly one Address. Given this composition relationship and assuming that Customer holds the primary key for Address in a persistent field, which methods might be part of the implementation for Customer?

A. The ejbRemove() method of Customer invokes the remove() method of Address.
B. The ejbLoad() method of Customer invokes the findByPrimaryKey() method of AddressHome.
C. The ejbLoad() method of Customer invokes the ejbLoad() method of Address.
D. The ejbStore() method of Customer invokes the ejbStore() method of Address.
E. The ejbPassivate() method of Customer invokes the ejbPassivate() method of Address.
Select 2 answers.

Answers Given are : A and B
 
Keerthi P
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot use option C,D and E as ejbLoad(), ejbStore() and ejbPassivate() are container callbacks and you should not call these methods on Address bean from Customer bean. According to the spec, they are meant to be called by the container.

Note that the scenario explained is a BMP case. So it is upto the implementation to decide how the related beans are loaded and removed. In this case, Customer bean 'contains' Address bean, a parent-child relationship.


A. The ejbRemove() method of Customer invokes the remove() method of Address.

This could be a possible implemention. This will have an effect of deleting the associated Address record whenever a Customer record is deleted.

B. The ejbLoad() method of Customer invokes the findByPrimaryKey() method of AddressHome.

This could also be a possible implementation. This will have an effect of loading the Address details into a Customer bean whenever the Customer bean is loaded at the beginning of transaction.
[ February 22, 2005: Message edited by: Keerthi P ]
 
Binoj Viswanathan
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

Since its composition relationship, ven customer is removed,customerBean shd remove the corresponding Address bean. it does this either by invoking remove(PK of AddressBean) on home of AddressBean or using AddressBeanComponenetIntf.remove()

So the option A is correct


Ven the CustomerBean shd b loaded, the container calls ejbLoad() its bean instance.At the same time U need to identify the Address bean which is related to current CustomerBean. so u find the Address bean using findByPrimaryKey(PK) on its home.Then call a biz meth on its remote obj , then the container wil synch persistant data by calling ejbLoad() and ejbStore() with ur DB entity.

So the option B is correct


ejbLoad() ,ejbStore() and ejbPassivate() container call-backs. So options S,D and E are completely incorrect.



binoj
 
Vishnu Munnangi
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Keerthi and Binoj for nice explanation
 
Binoj Viswanathan
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh! No !! I's in the middle of writing my RE-msg, and din't see Keerthi's reply!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic