hi, can somebody explain me why we use the finder method in entity bean.and when i am writing two finder method i.e. suppose by name and by primary key as per the example in Ed Roman book in the client program first i am searching it by name then from that i am getting the primary key object and doing the search by primary key .can i give only one finder method i.e. by primary key?
Hi sasmit, We have a naming policy here at JavaRanch where all publicly displayed names take the form, "Firstname Surname". Could you please edit your profile to bring it into line? Thanks in advance and we hope that you enjoy your stay at the ranch! Cheers Simon
Entity beans represent shared data. There must be some mechanism to access shared data ..this is done by using finder methods. Finder methods allow u to access the enity that is already present..Only one finder method is mandatory in enity i.e. findByPrimaryKey..
Let us say you want to change the quantity available field of the Product EJB. This ejb instance is already there. To udate the quantity you need to get to the Remote Interface of the bean. The question now is how do you get to the remote interface. You cannot use create as create creates a record and if you try to create the product again it will fail. In such a scenario you will write a finder which will help you get access to a reference to the remote interface through which you can do your Product. Rahul
And its not as if there are only finder methods in an entity ejb.....there can be other methods in the remote interface.......but of course there should be no DB calls for EB's do we try to keep them only on a need basis ........ HTH Sahil
Joined: Apr 12, 2002
hi, this is for the first time i put a que on this forum and nice to see the kind of response i got for my que.i'll come with more doubts soon.thnk you all. sasmit