ERROR : DefaultDispatcherErrorHandler Exception occurred during processing request: failed to lazily initialize a collection of role: com.javaimplant.socialnetwork.model.User.friend, could not initialize proxy - no Session
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.javaimplant.socialnetwork.model.User.friend, could not initialize proxy - no Session
I got this error while trying to map a One to Many relation in my Hibernate Entity.
The issue can be resolved by adding the following fetch property above our Entity Property.
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.javaimplant.socialnetwork.model.User.friend, could not initialize proxy - no Session
I got this error while trying to map a One to Many relation in my Hibernate Entity.
The issue can be resolved by adding the following fetch property above our Entity Property.
@OneToMany(fetch = FetchType.EAGER)
private Set<User> friend;