Hi Kevin,

Thanks for bringing up this suggestion. I'd like to point out that the lazy loading 
strategy you describe is possible with most or all persistence managers (certainly with
MVCSoft), but suffers from the famous "n+1" problem. In other words, the EJB container 
would issue one query to get the list of PKs, and one query for each bean to
load its state data. I think it's fair to say that any persistence engine that *only* 
supported this strategy could be considered a toy, as performance and scaling will be
disasterous.

Most EJB containers will let you define a set of data to "eagerly load," getting the 
numbers of queries down to 1. One query is almost always better than 1001, which is
why this solution to the "subset" problem usually isn't ideal.

The MVCSoft PM goes a step beyond this, letting you solve the n+1 problem for any 
amount of related data as well.

By the way, I'd have to be convinced that loading 1million PKs wouldn't be a serious 
resource hit every time you needed 1,000 entities. :-)

-Dan

On 26 Nov 2002 at 14:52, Kevin Gaasch wrote:

> I believe that most containers only query PKs in in the finder method.
> The actual bean isn't loaded until you access it.  Assuming this is
> true, 1million PKs shouldn't be a serious resource hit and you can
> handle the situation however your project requires in the code (i.e.
> throw error request a more specific search).
>
> Kevin E. Gaasch
> Panhandle Plains Student Loan Center
> Software Craftsman
> Work: 806.324.4100 x4215
> Cell: 806.674.1523
>
> >>> Daniel OConnor <[EMAIL PROTECTED]> 11/26/02 05:59AM >>>
> The MVCSoft Persistence Manager supports this feature by allowing you
> to specify a "wrapper method" for the finder with two additional
> parameters specifying the exact
> set of records you want. There are a variety of ways you can configure
> the engine to accomplish this behind the scenes, e.g. "limit/offset"
> syntax, or scrollable cursors,
> or simple result set iteration.
>
> This wrapper method can be abstract, because the MVCSoft deployment
> tools provide an implementation. Alternatively, you can implement the
> method with code that
> manually iterates a result collection to get the records you want. This
> will maintain portability of functionality (although deploying the
> application on an EJB container
> with a different persistence mechanism might in practice be a
> "performance bug").
>
> The MVCSoft PM is available for JBoss, Jonas, WebLogic, WebSphere,
> Orion, OC4J, and JRun.
>
> -Daniel O'Connor
>
>
> On 25 Nov 2002 at 19:24, Milind Kulkarni wrote:
>
> > Hi All,
> >
> > We have more than 1 million records in Customer Database.  We have
> > requirement that the output of a search query should be limited to
> 1000
> > records only.  Can anybody quickly let me know how do you achieve
> this
> > using EJB-QL.
> >
> > Thanks in Advance !
> > Regards,
> > Milind
> >
> >
> ===========================================================================
> > 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".
>

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

Reply via email to