How to solve the “failed to lazily initialize a collection of role” Hibernate exception

If you know that you’ll want to see all Comments every time you retrieve a Topic then change your field mapping for comments to: @OneToMany(fetch = FetchType.EAGER, mappedBy = “topic”, cascade = CascadeType.ALL) private Collection<Comment> comments = new LinkedHashSet<Comment>(); Collections are lazy-loaded by default, take a look at this if you want to know more.

How to upload a file and JSON data in Postman?

In postman, set method type to POST. Then select Body -> form-data -> Enter your parameter name (file according to your code) and on right side next to value column, there will be dropdown “text, file”, select File. choose your image file and post it. For rest of “text” based parameters, you can post it like normally you do with … Read more