Use @Transactional where appropriate

This commit is contained in:
Dave Syer 2013-11-05 11:28:24 +00:00
parent fa998287ab
commit 7006f222ab

View File

@ -19,6 +19,7 @@ package org.springframework.boot.sample.data.jpa.web;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.sample.data.jpa.service.CityService;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@ -30,6 +31,7 @@ public class SampleController {
@RequestMapping("/")
@ResponseBody
@Transactional(readOnly = true)
public String helloWorld() {
return this.cityService.getCity("Bath", "UK").getName();
}