Some caveats for the approach below: - DB specified, rownum is an Oracle thing - select * will bite you in the ass if your table structure ever changes
There are actually approaches for doing a limit type finder, using a poll/seek algorithm... On 4/4/02 4:59 pm, "The elephantwalker" <[EMAIL PROTECTED]> wrote: > Curt, > > I don't know anybody that uses the vanilla findAll() in a cmp finder. In > orion, it is _extremely_ easy to add a customer finder findAll that has a > limit. Here is my findAll for Oracle(oracle doesn't have LIMIT): > > <finder-method partial="false" query="select * from (select a.*, rownum rn > from (select somebean.* from somebean order by somebean.lastmodified desc) a > where rownum < ($1 + $2) ) where rn >= $1" > > <method> > <ejb-name>somebean</ejb-name> > <method-name>findAll</method-name> > <method-params> > <method-param>int</method-param> > <method-param>int</method-param> > </method-params> > </method> > </finder-method> > > You could likewise use a stored procedure in the <finder-method> for even > greater speed. > > With these finders, cmp _rocks_! > > regards, > > the elephantwalker > www.elephantwalker.com > > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of Curt Smith > Sent: Thursday, April 04, 2002 9:21 AM > To: Orion-Interest > Subject: Re: CMP 2.0 vs BMP - Which performes better? > > > >> There are several constraints to BMP beans which make them almost always >> perform slower than CMP beans. In particular, the inability to bulk >> load beans from finder methods is a nearly fatal defect. > > > I'd like to know more of the details? > > How does the container deal with the following finder in CMP > differently than BMP? > > Collection remoteRefs = home.findSalaryGreaterThan ( "50,000"); > > Or what was the scenario you where refering to? > > To me the finder returns a collection problem is but one of the > damning EJB achilies heals, in that the spec left out setting > the max row count to limit the find collection to. > > How does CMP help the huge memory and CPU and JNDI hit that > a boundless findAll() causes? > > > Thanks, curt > > > > > >
