I have the next class:
@Entity
public class Task{
@OneToMany(mappedBy = "parent")
private Set<Task> childs;
@ManyToOne(cascade = CascadeType.MERGE)
private Task parent;
}
Which by default has Eager loading if I'm not wrong, the question is as follows:
What will happen when I try to load the last task if I have a lineal tree with a big number of task and everyone is child of his predecessor? Will it eagerly load all the task in the tree?
e.g:
Task 1; //parent of 2
Task 2; //parent of 3
.
.
.
Task n-1; //parent of n
Task n; //parent of n+1
If I load n, which eagerly will load n-1, makes n-1 eagerly load n-2 and so on?