From 7bda571a2740333749ef5b7649dfc700f9447819 Mon Sep 17 00:00:00 2001 From: tommi27 Date: Thu, 9 Apr 2020 15:25:34 +0200 Subject: [PATCH] thermostat in an entity now --- .../usi/inf/sa4/sanmarinoes/smarthut/models/Thermostat.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/Thermostat.java b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/Thermostat.java index 338fb29..04606aa 100644 --- a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/Thermostat.java +++ b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/Thermostat.java @@ -2,9 +2,12 @@ package ch.usi.inf.sa4.sanmarinoes.smarthut.models; import java.math.BigDecimal; import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.OneToOne; import javax.validation.constraints.NotNull; /** A thermostat capable of controlling cooling and heating. */ +@Entity public class Thermostat extends InputDevice { enum ThermostatState { @@ -18,7 +21,7 @@ public class Thermostat extends InputDevice { @Column @NotNull BigDecimal averageTemperature; - @Column @NotNull private final Sensor temperatureSensor; + @Column @NotNull @OneToOne private final Sensor temperatureSensor; @Column @NotNull private ThermostatState state;