Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] batch reading with separate fetch size setting

James,

your idea to prepare() the query to get the nested batch query via getBatchReadMappingQueries() is nice but prepare() in ReadAllQuery is not visible due to protected access ... or am I overlooking something?



----- Original Message ----
From: James Sutherland <jamesssss@xxxxxxxxx>
To: eclipselink-users@xxxxxxxxxxx
Sent: Monday, October 6, 2008 4:58:57 PM
Subject: Re: [eclipselink-users] batch reading with separate fetch size setting


There is no query hint to do this, feel free to log an enhancement request
for this.

You can configure this using the ReadAllQuery code API.

> 
> James,
> 
> I have three related entities say A, B, C with an OneToMany mapping both
> between A - B and A - C . There is a need to read all the objects in a
> single query. Therefore i've defined a named query in A as follows:
> 
> @NamedQuery(
>     name = "A.findAll", 
>     query = "SELECT a FROM A a , 
>     hints = { 
>         @QueryHint(name = QueryHints.BATCH, value = "a.bs"),
>         @QueryHint(name = QueryHints.BATCH, value = "a.cs"),
>         @QueryHint(name = QueryHints.JDBC_FETCH_SIZE, value = "500")
>     }
> )
> 
> As result I got about 500 objects for A, 5000 objects for B and 50000
> objects for C from the three queries (the one named and the two batch
> queries). Regarding the tuning of the jdbc fetch size I can only define a
> single value as query hint as far as I can gather. I take it that it will
> only taking effect for the A-query wouldn't it? How may I effect then the
> fetch size for the batch queries. Or, I'm totally wrong here?
> 
> --- On Thu, 10/2/08, James Sutherland <jamesssss@xxxxxxxxx> wrote:
> From: James Sutherland <jamesssss@xxxxxxxxx>
> Subject: Re: [eclipselink-users] batch reading with separate fetch size
> setting
> To: eclipselink-users@xxxxxxxxxxx
> Date: Thursday, October 2, 2008, 6:57 AM
> 
> I'm not exactly sure I understand what you mean perhaps give an example.
> 
> Assuming you want to set the fetch size of the nested batch queries, there
> is no easy way to do this.  However you could prepare() your query, then
> access the getBatchReadMappingQueries() that are generated to customize
> any
> of the nested batch queries.
> 
> 
> 
> Kate Lain wrote:
>> 
>> Hi,
>> 
>> 
>> 
>> for performance reasons I've optimized my queries using batch reading
>> and fetch size tuning - but is there a way to set the fetch size separate
>> per
>> batch query?
>> 
>> Thomas
>> 
> 


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/batch-reading-with-separate-fetch-size-setting-tp19767497p19839612.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users



      



Back to the top