Spring Data Rest is a project is to provide a solid foundation on which to expose CRUD operations to your JPA Repository-managed entities using plain HTTP REST semantics. The first implementation of this exporter uses Spring MVC and the standard Servlet architecture to make it easy to deploy a WAR file that becomes a full-blown CRUD application simply by including your domain classes and their corresponding Repository definitions.
As I started to work to a small project based on Spring MVC + JPA2/Hibernate + Rest, I faced this interesting exception which is known as LazyInitializationException.
Before we discuss about the exact error and the solution, let me show you what I did and I came up to face that issue.
As I said before I had a project which is using JPA2/Hibernate, so I provided some entities and daos in order to communicate and get data from my database.
For example I had the Table User(Getters/Setters are omitted):