I have an entity Person:
class Person {
String name;
String phone;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
Set<Address> addresses = new HashSet<Address>();
}
When I display persons at table I don’t want to load addresses.
When I open edit dialog, I want to display addresses too. But I got Lazzy loading exception (there is no active session).
How can I reinitialize Person instance to load addresses?
Call another method which will reload the person from database along with his addresses:
or
to do it in a single query.