how to lazy load collection when using spring-data-jpa, with hibernate, from an console application
One solution can be to make User.orders an eagerly fetched collection by @OneToMany(cascade=CascadeType.ALL, fetch = FetchType.EAGER) private Set<Order> orders = new HashSet<Order>(); Entity associations are lazily loaded by default. This means that the orders Set is actually just a proxy object that won’t get initialized until you invoke a method on it. This is good, … Read more