Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » How to use eclipselink.batch with em.find()?(eclipselink.batch will speed up queries -- but how to use with em.find()?)
How to use eclipselink.batch with em.find()? [message #1064252] Tue, 18 June 2013 08:24 Go to next message
Eclipse UserFriend
It is common sense that eclipselink.batch hint will speed up queries. But how can this be used to speed up @OneToMany relationships when running em.find()? As the query is implied, one doesn't know the QL Name to provide as the value of eclipselink.batch!
Re: How to use eclipselink.batch with em.find()? [message #1064301 is a reply to message #1064252] Tue, 18 June 2013 11:04 Go to previous messageGo to next message
Eclipse UserFriend
You can only use a batch fetch on a query that returns multiple objects. find() only returns a single objects, so batch fetching would have not benefit.

If you are trying to batch fetch a relationship of the target of the OneToMany, then you could use the @BatchFetch annotation on the target's relationship.
Re: How to use eclipselink.batch with em.find()? [message #1064403 is a reply to message #1064301] Wed, 19 June 2013 02:28 Go to previous messageGo to next message
Eclipse UserFriend
Okay I forgot to mention that the single entity returned has a fetch=EAGER relationship with loads lots of child entities. That is what I want to speed up. Smile
Re: How to use eclipselink.batch with em.find()? [message #1064404 is a reply to message #1064403] Wed, 19 June 2013 02:30 Go to previous messageGo to next message
Eclipse UserFriend
I know that I can use @BatchFetch Annotation. The problem is that my code must not load Eclipse-specific classes, since it must stay portable. So I *must* use a hint at the em.find() command. I should have told the whole story right from the start to make it more clear.
Re: How to use eclipselink.batch with em.find()? [message #1065379 is a reply to message #1064404] Tue, 25 June 2013 09:52 Go to previous message
Eclipse UserFriend
You can also define @BatchFetch in your EclipseLink orm.xml.

You could probably also change your find() to instead use a Query and define the batch fetch on both the relationship and the child relationship.

RE: one doesn't know the QL Name to provide as the value of eclipselink.batch
Well this QL name is ignored anyway, you should be able to put any alias you want there as long as the syntax is correct.
Previous Topic:Could not load the method for the property name
Next Topic:How to access Primary Key instance of entity relationship?
Goto Forum:
  


Current Time: Tue Jul 01 09:10:19 EDT 2025

Powered by FUDForum. Page generated in 0.08183 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top