Re: Performance for Finders

"Kalra, Ashwani" <[email protected]>
Newsgroups gmane.comp.java.sun.ejb.general
Message-ID <8F1AE52435C67D40944C289891293A7C0248F396@ntbomex001>
Please ignore the earlier mails from me on this subject.

This requirement does not apply to the ejbFindByPrimaryKey method..... "
This raises further curiousity!!    Why  ?

/Ashwani


-----Original Message-----
From: Vikram Naik [mailto:[email protected]]
Sent: Wednesday, August 06, 2003 9:17 PM
To: [email protected]
Subject: Re: Performance for Finders


Hello ,

Johan is right by saying  "Custom finders will always require a database
roundtrip (most app servers) even if the resulting row already has a
representation in the cache".

As said in the specs for EJB 2.1 under  section "10.5.3 Container's View"

"public <primary key type or collection> ejbFind<METHOD>(...);

.... The container invokes the ejbFind<METHOD> method on an instance when a
client invokes a matching find<METHOD> method on the entity bean's home
interface.
The container must pick an instance that is in he pooled state (i.e., the
instance is not associated with any entity object identity) for the
execution of the ejbFind<METHOD> method.
If there is no instance in the pooled state, the container creates one and
calls he setEntityContext method on the instance before dispatching the
finder method. ......

Before invoking the ejbFind<METHOD> method, the container must first
synchronize the state of those entity bean instances by invoking the
ejbStore method on them.
This requirement does not apply to the ejbFindByPrimaryKey method..... "

This means there can be difference in performance between the customFinders
and findByPrimaryKey methods
As that the container has to/needs to sync the states of all the beans by
invoking ejbStore method, which amounts to database roundtrip

thanks & regards,
Vikram Naik

----- Original Message -----
From: Johan  <mailto:[email protected]> Eltes
To: [email protected] <mailto:[email protected]>
Sent: Wednesday, August 06, 2003 3:28 PM
Subject: Re: Performance for Finders


findByPrimayKey  allows the app server to pick the object from an entity
cache without a roundtrip to the database. Custom finders will always
require a database roundtrip (most app servers) even if the resulting row
already has a representation in the cache.

/Johan

Den 03-08-06 10.05, skrev "Vikram Naik" < [email protected]
<mailto:[email protected]> >:



Hello All,

   Is there a performance difference between the findByPrimayKey and
customFinders ?

Ofcourse the performance of the custom finders will depend on the query, but
fot this case we can consider the query of the custom finders will be as
simple as that of the findByPrimaryKey!!

Please comment.

TIA,
Vikram Naik
===========================================================================
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".





===========================================================================
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".



===========================================================================
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".




____________________________________________________
This message contains information that may be privileged or confidential and
is the property of the Cap Gemini Ernst & Young Group. It is intended only
for the person to whom it is addressed. If you are not the intended
recipient, you are not authorised to read, print, retain, copy, disseminate,
distribute, or use this message or any part thereof. If you receive this
message in error, please notify the sender immediately and delete all copies
of this message.

===========================================================================
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".
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.