From 25d9ac6535470727d04cbb290f191a33b685fb45 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Thu, 5 Dec 2013 09:38:10 +0000 Subject: [PATCH] Remove FIXME from JPA sample --- .../boot/sample/data/jpa/domain/ReviewDetails.java | 8 -------- .../boot/sample/data/jpa/service/CityServiceImpl.java | 2 -- .../boot/sample/data/jpa/service/HotelServiceImpl.java | 7 ++----- .../boot/sample/data/jpa/service/ReviewRepository.java | 2 ++ 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/org/springframework/boot/sample/data/jpa/domain/ReviewDetails.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/org/springframework/boot/sample/data/jpa/domain/ReviewDetails.java index caec1b4681..e9275be21f 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/org/springframework/boot/sample/data/jpa/domain/ReviewDetails.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/org/springframework/boot/sample/data/jpa/domain/ReviewDetails.java @@ -19,8 +19,6 @@ package org.springframework.boot.sample.data.jpa.domain; import java.io.Serializable; import java.util.Date; -//FIXME Hibernate bug HHH-5792 prevents this being embedded - public class ReviewDetails implements Serializable { private static final long serialVersionUID = 1L; @@ -38,12 +36,6 @@ public class ReviewDetails implements Serializable { public ReviewDetails() { } - @Deprecated - public ReviewDetails(String title, Rating rating) { - this.title = title; - this.rating = rating; - } - public Rating getRating() { return this.rating; } diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/org/springframework/boot/sample/data/jpa/service/CityServiceImpl.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/org/springframework/boot/sample/data/jpa/service/CityServiceImpl.java index e1f7edaf35..46a64d92fc 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/org/springframework/boot/sample/data/jpa/service/CityServiceImpl.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/org/springframework/boot/sample/data/jpa/service/CityServiceImpl.java @@ -30,8 +30,6 @@ import org.springframework.util.StringUtils; @Transactional class CityServiceImpl implements CityService { - // FIXME deal with null repository return values - private final CityRepository cityRepository; private final HotelRepository hotelRepository; diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/org/springframework/boot/sample/data/jpa/service/HotelServiceImpl.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/org/springframework/boot/sample/data/jpa/service/HotelServiceImpl.java index 14918cc7f6..fcb2f93758 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/org/springframework/boot/sample/data/jpa/service/HotelServiceImpl.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/org/springframework/boot/sample/data/jpa/service/HotelServiceImpl.java @@ -37,8 +37,6 @@ import org.springframework.util.Assert; @Transactional class HotelServiceImpl implements HotelService { - // FIXME deal with null repository return values - private final HotelRepository hotelRepository; private final ReviewRepository reviewRepository; @@ -71,9 +69,8 @@ class HotelServiceImpl implements HotelService { @Override public Review addReview(Hotel hotel, ReviewDetails details) { - // FIXME - System.out.println(details.getTitle()); - return new Review(hotel, 1, details); + Review review = new Review(hotel, 1, details); + return reviewRepository.save(review); } @Override diff --git a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/org/springframework/boot/sample/data/jpa/service/ReviewRepository.java b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/org/springframework/boot/sample/data/jpa/service/ReviewRepository.java index 37a9858c40..f95a6514e6 100644 --- a/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/org/springframework/boot/sample/data/jpa/service/ReviewRepository.java +++ b/spring-boot-samples/spring-boot-sample-data-jpa/src/main/java/org/springframework/boot/sample/data/jpa/service/ReviewRepository.java @@ -27,5 +27,7 @@ interface ReviewRepository extends Repository { Page findByHotel(Hotel hotel, Pageable pageable); Review findByHotelAndIndex(Hotel hotel, int index); + + Review save(Review review); }