You are correct, John. Finder methods should merely ensure the existence of the entity in persistent storage, and return the correct PK for each entity. Finder methods should not access the bean instance's state. There is no need to even select more than the PK's from a finder method. "Finlay, John A" wrote: > Sowmya said: > > * So, if ejbFindByPrimaryKey is going to call ejbLoad() ( and in turn > refresh() ) > * then why should I call refresh() in the ejbFindByPrimaryKey() method > also? > > According to Valesky's book, "...finder methods are invoked on beans that > are in the pooled state; thus, when you're implementing a finder method, you > shouldn't try to access the object's state." (Likely) another bean will be > activated and do the ejbLoad. Monson-Haefel's book says the same thing but > then gives an example where the ejbFBPK method does (the equivalent of) a > refresh. I'd like to think Valesky's approach is correct. > > Valesky gives a BMP ejbFBPK example where the query is checking for > existence (count(*)), and not actually retrieving data. So your ejbFBPK > method should not be calling refresh(), imho. > > John Finlay, Enterprise Architect > Applied Technology Research (ATR) Group > EDS Systemhouse, Inc. > > =========================================================================== > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body > of the message "signoff EJB-INTEREST". For general help, send email to > [EMAIL PROTECTED] and include in the body of the message "help".
begin:vcard n:Wilson;Chip tel;fax:(214) 358-0353 tel;work:(214) 642-4559 x-mozilla-html:TRUE url:http://www.axyssolutions.com/ org:Axys Solutions adr:;;;Dallas;TX;; version:2.1 email;internet:[EMAIL PROTECTED] title:Application Architect note:Sun Certified Java Architect x-mozilla-cpt:;-25088 fn:Chip Wilson end:vcard
