Commit 7006f222 authored by Dave Syer's avatar Dave Syer

Use @Transactional where appropriate

parent fa998287
...@@ -19,6 +19,7 @@ package org.springframework.boot.sample.data.jpa.web; ...@@ -19,6 +19,7 @@ package org.springframework.boot.sample.data.jpa.web;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.sample.data.jpa.service.CityService; import org.springframework.boot.sample.data.jpa.service.CityService;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
...@@ -30,6 +31,7 @@ public class SampleController { ...@@ -30,6 +31,7 @@ public class SampleController {
@RequestMapping("/") @RequestMapping("/")
@ResponseBody @ResponseBody
@Transactional(readOnly = true)
public String helloWorld() { public String helloWorld() {
return this.cityService.getCity("Bath", "UK").getName(); return this.cityService.getCity("Bath", "UK").getName();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment