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

Strange,  is "a.es" always ignored in the second case if it is combined with other batch hints or does the order or number of hints matter?
--Gordon

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

Back to the top