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

This commit is contained in:
Jacob Salvi 2020-02-28 16:51:31 +01:00
parent ce939cb7ea
commit c853c4cd4e

View file

@ -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<T extends Device> extends CrudRepository<T, Long> {
List<T> findByRoomId(@Param("roomId") long roomId);
}