Not only that, but w/ commit option B it seems that there's info left in
the "context" that may/may not be enough to keep some of the relevant data
(where to start reading again, etc) asl well. I'm looking at the code to
try to see how it all hangs together.

In a couple of days I'll be a read-ahead/preload cache expert, and
hopefully be able to provide more useful info in the future.

Dave



                                                                                       
                                                    
                      Alex Loubyansky                                                  
                                                    
                      <[EMAIL PROTECTED]>                 To:       julien viet 
<[EMAIL PROTECTED]>                          
                      Sent by:                           cc:                           
                                                    
                      [EMAIL PROTECTED]        Subject:  Re[5]: [JBoss-user] Page by 
Page iteration                              
                      ceforge.net                                                      
                                                    
                                                                                       
                                                    
                                                                                       
                                                    
                      05/06/2003 11:22 AM                                              
                                                    
                      Please respond to                                                
                                                    
                      jboss-user                                                       
                                                    
                                                                                       
                                                    
                                                                                       
                                                    




Yes, but with commit option A data is still in the cache and no need
to go to the db.

alex

Tuesday, May 06, 2003, 3:56:56 PM, julien viet wrote:

jv> per spec, cmr collections are meant to be used in the transaction
jv> that created it and discarded after.

jv> julien

Dnc>> Julien,

Dnc>> The JBossCMP book seems to indicate that this is not the case w/
commit
Dnc>> option B:

Dnc>> "JBossCMP assumes that there is more than one user of the database
but
Dnc>> keeps the
Dnc>> context information about entities between transactions. This context
Dnc>> information is used
Dnc>> for optimizing loading of the entity. [20]This is the default commit
Dnc>> option."

Dnc>> is that wrong, or am I just misunderstanding it? (I would have
assumed that
Dnc>> the "context" info mentioned there was the list cache data).

Dnc>> If so, why would on_load be any better than on_find -- just because
you may
Dnc>> load less data depending on when you stop iterating through the
collection?

julien>>> you can associate a read-ahead on_load with the size of the
julien>>> limit parameter.

Dnc>> But then you need to find a way to ensure that the on_load page-size
in the
Dnc>> deployment descriptor and the limit paramether your code passes in
stay in
Dnc>> sync. Can LIMIT take a literal?

Dnc>> And wouldn't on_find work just as well in this case (since you're
certain
Dnc>> you're going to read all the returned entries unless an exception
occurs).

Dnc>> Dave




Dnc>>                       julien viet

Dnc>>                       <[EMAIL PROTECTED]>                 To:
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
Dnc>>                       Sent by:                           cc:

Dnc>>                       [EMAIL PROTECTED]        Subject:
Re[2]: [JBoss-user] Page by Page iteration
Dnc>>                       ceforge.net



Dnc>>                       05/06/2003 07:41 AM

Dnc>>                       Please respond to

Dnc>>                       jboss-user







Dnc>>> Can't you use read-ahead w/ on_load strategy? I.e., in
Dnc>> jbosscmp-jdbc.xml,
Dnc>>> have something like:
Dnc>> this will not work because you cannot cache a collection
Dnc>> between transactions.

Dnc>> what you should try is the use of JBossQL limit offset :
Dnc>> SELECT OBJECT(o) FROM object AS o ORDER BY o.id OFFSET ?1 LIMIT ?2

Dnc>> this will give you what you want. this will work efficiently
Dnc>> on relatively small size collection < 10000.

Dnc>> you can associate a read-ahead on_load with the size of the limit
Dnc>> parameter.

Dnc>> julien

Dnc>>> Can't you use read-ahead w/ on_load strategy? I.e., in
Dnc>> jbosscmp-jdbc.xml,
Dnc>>> have something like:

Dnc>>> <entity>
Dnc>>>       <ejb-name>MyEJB</ejb-name>
Dnc>>>       <query>
Dnc>>>             <query-method>
Dnc>>>                   <method-name>findAll_paged</method-name>
Dnc>>>                   <method-params/>
Dnc>>>             </query-method>
Dnc>>>             <jboss-ql><![CDATA[SELECT OBJECT(o) FROM my_table o
ORDER
Dnc>> BY
o.somefield]]>>>></jboss-ql>
Dnc>>>             <read-ahead>
Dnc>>>                   <strategy>on_load</strategy>
Dnc>>>                   <page-size>20</page-size>
Dnc>>>             </read-ahead>
Dnc>>>       </query>
Dnc>>> </entity>

Dnc>>> Then your finder will pre-load the data for the first 20 rows into
the
Dnc>>> pre-load cache, and I believe that when you iterate to #21 it'll
grab
Dnc>> the
Dnc>>> data for the next 20.

Dnc>>> I'm not sure how this works when you throw CMR into the mix.

Dnc>>> And of course, it's not portable.

Dnc>>> Dave




Dnc>>>                       "Brian McSweeney"

Dnc>>>                       <[EMAIL PROTECTED]        To:
Dnc>> <[EMAIL PROTECTED]>
Dnc>>>                       >                                  cc:

Dnc>>>                       Sent by:                           Subject:
Dnc>> [JBoss-user] Page by Page iteration
Dnc>>>                       [EMAIL PROTECTED]

Dnc>>>                       ceforge.net



Dnc>>>                       05/06/2003 05:51 AM

Dnc>>>                       Please respond to

Dnc>>>                       jboss-user







Dnc>>> Hi everyone,

Dnc>>> I'm looking for a little advice. I'm implementing a struts-jboss web
Dnc>> app
Dnc>>> which
Dnc>>> uses page-by-page data iteration. On the ejb side I'm using session
Dnc>> facades
Dnc>>> with cmp & cmr entity beans. However, in order to get the relevant
Dnc>> data
Dnc>>> back
Dnc>>> to iterate over, I currently have to utilise findAll, to retrieve a
Dnc>>> collection of
Dnc>>> entity beans.

Dnc>>> This is surely not good - as the data gets large, I'm getting back
Dnc>>> thousands
Dnc>>> of ejbs, just to display the first 20 or 30 on the first page. I
Dnc>> presume
Dnc>>> the
Dnc>>> correct way to do this with raw sql would be something like:

Dnc>>> 1) Get a count of all the relevant rows
Dnc>>> 2) Select the first 20
Dnc>>> 3) For each next page, select 20 offsetting at the relevant point.

Dnc>>> Am I correct in this being the proper approach?

Dnc>>> However, I haven't used raw sql with ejbs and I'm not sure how to.
Dnc>>> Advice here please.

Dnc>>> Finally, if I use raw sql, are stored procedures the correct way to
Dnc>> go.
Dnc>>> I've been told that they are considerably faster.
Dnc>>> thanks for all your help,
Dnc>>> Brian



-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user







-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to