I have a simple controller that return a User object, this user have a attribute coordinates that have the hibernate property FetchType.LAZY.
When I try to get this
For those who came here looking to find the solution for Apache CXF-based RESTful service, the configuration that fixes it is below:
Where HibernateAwareObjectMapper is defined as:
public class HibernateAwareObjectMapper extends ObjectMapper {
public HibernateAwareObjectMapper() {
registerModule(new Hibernate5Module());
}
}
The following dependency is required as of June 2016 (provided you're using Hibernate5):
com.fasterxml.jackson.datatype
jackson-datatype-hibernate5
2.7.4