Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Batch Reading query hint appearing to be ignored

This is a bug in EclipseLink's hint, currently only a single hint is allowed
for each type (they are stored as a Map).  I had thought there was a bug for
this, but could not find one, so please log this bug.  Please also post the
bug id, as I would like to vote for this one too.



Gschwind, Doug wrote:
> 
> Hello everyone,
> 
>  
> 
> I have an EclipseLink 1.0.1 mapped class A that has mapped relationships
> to a number of other classes. I wish to reduce the number of queries
> being executed by using EclipseLink Batch Reading across some of those
> relationships. Lets say those relationships are to classes of type B, C,
> D, and E. Those relationship types are one OneToOne, two OneToManys, and
> one ManyToMany. I have a named query that appears to handle the batching
> of classes of type E, but when I expand the query hints to include
> classes B, C, and D, it does not appear that all instances of B are
> attempted to be read in one SQL statement, same for the instances of C
> and D. I start with an annotation based named query of the following
> form:
> 
>  
> 
> @NamedQuery(name="A.findForContext",
> 
>             query = "SELECT a FROM A a WHERE a.id=:aId",
> 
>             hints={@QueryHint(name=CACHE_USAGE, value=DoNotCheckCache),
> 
>                    @QueryHint(name=REFRESH_CASCADE,
> value=CascadeByMapping),
> 
>                    @QueryHint(name=QueryHints.REFRESH, value=TRUE),
> 
>                    @QueryHint(name=BATCH, value="a.es")})
> 
>  
> 
> And EclipseLink honors that batch reading hint by executing one query to
> hydrate all of the E instances given a set of A instances already
> hydrated. Now, if I expand the query hints as described below to request
> that B, C, and D instances also be batch read, I see one query for each
> B, C, and D instance for a given A instance, not what I am hoping for.
> 
>  
> 
> @NamedQuery(name="A.findForContext",
> 
>             query = "SELECT a FROM A a WHERE a.id=:aId",
> 
>             hints={@QueryHint(name=CACHE_USAGE, value=DoNotCheckCache),
> 
>                    @QueryHint(name=REFRESH_CASCADE,
> value=CascadeByMapping),
> 
>                    @QueryHint(name=QueryHints.REFRESH, value=TRUE),
> 
>                    @QueryHint(name=BATCH, value="a.bs"),
> 
>                    @QueryHint(name=BATCH, value="a.cs"),
> 
>                    @QueryHint(name=BATCH, value="a.ds"),
> 
>                    @QueryHint(name=BATCH, value="a.es")})
> 
>  
> 
> Anyone have any ideas of why my batch based query hints would be
> ignored? I do not have any JoinFetch relationships in the mix here.
> 
>  
> 
> Thanks,
> 
>  
> 
> Doug
> 
> 
> 
> 
> 
> 
> 
> The contents of this electronic mail message and any attachments are
> confidential, possibly privileged and intended
> for the addressee(s) only. Only the addressee(s) may read, disseminate,
> retain or otherwise use this message. If
> received in error, please immediately inform the sender and then delete
> this message without disclosing its contents
> to anyone.
> 
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
> 
> 


-----
---
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-query-hint-appearing-to-be-ignored-tp20414067p20420959.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top