From 7006f222ab1f9856d95ed8d81bbbe58583463f76 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Tue, 5 Nov 2013 11:28:24 +0000 Subject: [PATCH] Use @Transactional where appropriate --- .../boot/sample/data/jpa/web/SampleController.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/org/springframework/boot/sample/data/jpa/web/SampleController.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/org/springframework/boot/sample/data/jpa/web/SampleController.java index 1b6fc6ad39..c572acb4cc 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/org/springframework/boot/sample/data/jpa/web/SampleController.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/org/springframework/boot/sample/data/jpa/web/SampleController.java @@ -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(); }