Questions tagged [fetching-strategy]
78 questions
70
votes
2 answers
Difference between LEFT JOIN and LEFT JOIN FETCH in Hibernate?
I am trying to understand the difference between LEFT JOIN and LEFT JOIN FETCH in Hibernate.
Can anyone explain this?
Thanks

Barry
- 1,585
- 3
- 22
- 35
55
votes
3 answers
What is Over-Fetching or Under-fetching?
I've been playing sometimes with graphQL. Before graphQL, we normally use REST API. Many developers said that graphQL fixes some problems of the REST. (e.g. over-fetching & under-fetching). I confuses with this terms.
Can somebody explain what is…

Saber Alex
- 1,544
- 3
- 24
- 39
20
votes
4 answers
Is there a way to change the JPA fetch type on a method?
Is there a way to change the JPA fetch type on a single method without editing the entity object?
I have a shared ORM layer consisting of JPA entity classes. This ORM layer is accessed by two DAO layers. One DAO needs lazy fetching, as it is for my…

James McMahon
- 48,506
- 64
- 207
- 283
19
votes
5 answers
NHibernate Eager Fetching Over Multiple Levels
I have a 3-leveled hierarchy of entities: Customer-Order-Line, which I would like to retrieve in entirety for a given customer, using ISession.Get(id). I have the following XML fragments:
customer.hbm.xml:

Ben Laan
- 2,607
- 3
- 29
- 30
13
votes
1 answer
Hibernate: batch_size? Second Level Cache?
I have a Hibernate domain object that gets loaded by different parts of the application. Sometimes it's advantageous to lazy load every association and others it's better to load the entire thing in one join. As a hopefully happy compromise I've…

davidemm
- 2,001
- 1
- 23
- 31
9
votes
2 answers
How does Hibernate's batch-fetching algorithm work?
I found this description of the batch-fetching algorithm in "Manning - Java Persistence with Hibernate":
What is the real batch-fetching
algorithm? (...) Imagine a batch size of
20 and a total number of 119
uninitialized proxies that have to…

Maciek Kreft
- 882
- 9
- 14
9
votes
4 answers
Is this the right way of using ThenFetch() to load multiple collections?
I'm trying to load all the collections eagerly, using NHibernate 3 alpha 1. I'm wondering if this the right way of using ThenFetch()?
Properties with plural names are collections. The others are just a single object.
IQueryable…

esegura
- 493
- 4
- 12
9
votes
3 answers
Force an eager select in NHibernate
I am trying to eagerly fetch collections using selects, but all I am
getting is inner joins. What is going on?
Session.CreateCriteria(typeof(Foo))
.SetFetchMode("Bars", FetchMode.Select)
.CreateAlias("Bars", "b")
.SetFetchMode("b.Bazes",…

cbp
- 25,252
- 29
- 125
- 205
7
votes
1 answer
Linq to NHibernate ThenFetch multiple properties
I've got this object graph:
// Lots of stuff omitted for brevity; these are all virtual properties and there
// are other properties which aren't shown on all classes.
class A {
B b;
C c;
DateTime timestamp;
}
class B {
X x;
Y…

configurator
- 40,828
- 14
- 81
- 115
5
votes
2 answers
Some queries regarding fetch strategies in hibernate and relation of fetchtype with fetchmode?
I have gone thru some of the links for hibernate fetch strategies on net.One brief and concise link i liked is
http://www.mkyong.com/hibernate/hibernate-fetching-strategies-examples/. We have four type of fetch strategies. these are…

M Sach
- 33,416
- 76
- 221
- 314
5
votes
1 answer
Fetch batch of iOS pictures
I would like to fetch fixed batches of the pictures located on an iOS device. I am using the new Photos Framework, and I already found this workaround:
PHFetchOptions *allPhotosOptions = [PHFetchOptions new];
allPhotosOptions.sortDescriptors =…

Alexandre Rozier
- 960
- 1
- 8
- 21
5
votes
1 answer
Android login with json object empty in fetching even if php file execution in browser Chrome is ok
Follows my fetching class
public class fetchUserDataAsyncTask extends AsyncTask {
User user;
GetUserCallback userCallBack;
public fetchUserDataAsyncTask(User user, GetUserCallback userCallBack) {
this.user =…

Domenico Pacecca
- 295
- 1
- 7
- 14
4
votes
4 answers
Skip child to fetching of parent - JPA
I am facing an issue where the data is getting fechted recursively. I wanted to avoid the child to fetch the parent data. Which is causing a recursive issue.
I have mentioned the code below
Pojo Structure
class Parent {
..
…
user5070277
3
votes
2 answers
Implementing Udi's Fetching Strategy - How do I search?
Background
Udi Dahan suggests a fetching strategy as a useful pattern to use for data access. I agree.
The concept is to make roles explicit. For example I have an Aggregate Root - Customer. I want customer in several parts of my application - a…

Thomas Coats
- 632
- 5
- 10
3
votes
1 answer
In React, fetch data conditional on results of an initial fetch
We have written a custom data fetching hook useInternalApi which is similar to the useDataApi hook at the very bottom of this fairly decent tutorial on data fetching with react hooks. Our app fetches a lot of sports data, and in particular, we are…

Canovice
- 9,012
- 22
- 93
- 211