title: Spring 4.2 Rest-Service With Hibernate 4 or 5 Example
body: <p>I am just starting to get into Spring and want to know if there are any example projects that expand on creating a rest service. I completed the rest-service tutorial (<a href="https://spring.io/guides/gs/rest-service/" rel="nofollow">https://spring.io/guides/gs/rest-service/</a>) and looked at a few others, but now have no clue how to incorporate hibernate into the mix.</p>
  
  <p>As you may know, Spring 4.2 uses the new @RestController annotation which converts a model into JSON. All I am really looking for is an example which stays true to the tutorial I did plus a connection to hibernate, 1 database table, a model, service, and DAO. I don't need any html/jsp pages, so I don't think I need to go down the MVC route, but I could be wrong.</p>
  
  <p>My thought is that I should be able to from the Controller do something like:</p>
  
  <pre><code>@RestController
  public class GreetingController 
  {
       @RequestMapping("/things")
       public List&lt;Thing&gt; getThings() 
       {
           ThingService service = new ThingService();
           return service.getThings();
       }
  }
  </code></pre>
  
  <p>Where ThingService would call the dao, and the dao to the database.</p>
  
  <p>Can anyone help? Linking to a good tutorial which does this, or taking the time to make me a super small example project would be greatly appreciated. Thank you in advance.</p>