From c853c4cd4e184e6c2dd1969f0c2714903b50d94d Mon Sep 17 00:00:00 2001 From: Jacob Salvi Date: Fri, 28 Feb 2020 16:51:31 +0100 Subject: [PATCH] Added a class DeviceRepository that is needed to mirror in the database the class inheritances that are present among the various Devices. Also the method getDevices, that returns a List of the Devices present in a given room, has been added to RoomController.java --- .../smarthut/models/DeviceRepository.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/DeviceRepository.java diff --git a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/DeviceRepository.java b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/DeviceRepository.java new file mode 100644 index 0000000..fdae66e --- /dev/null +++ b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/DeviceRepository.java @@ -0,0 +1,13 @@ +package ch.usi.inf.sa4.sanmarinoes.smarthut.models; + +import java.util.List; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +/** + * DeviceRepository acts as a superclass for the other repositories so to mirror in the database the + * class inheritance present among the various devices. + */ +public interface DeviceRepository extends CrudRepository { + List findByRoomId(@Param("roomId") long roomId); +}