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


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 = ""),
>         @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

--- James Sutherland
EclipseLink ,
Wiki: EclipseLink , TopLink 
Forums: TopLink , EclipseLink 
Book: Java Persistence 
View this message in context:
Sent from the EclipseLink - Users mailing list archive at

eclipselink-users mailing list


Back to the top