thermostat in an entity now

This commit is contained in:
Tommaso Rodolfo Masera 2020-04-09 15:25:34 +02:00
parent 7cfb2ffc73
commit 7bda571a27

View file

@ -2,9 +2,12 @@ package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
import java.math.BigDecimal; import java.math.BigDecimal;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToOne;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
/** A thermostat capable of controlling cooling and heating. */ /** A thermostat capable of controlling cooling and heating. */
@Entity
public class Thermostat extends InputDevice { public class Thermostat extends InputDevice {
enum ThermostatState { enum ThermostatState {
@ -18,7 +21,7 @@ public class Thermostat extends InputDevice {
@Column @NotNull BigDecimal averageTemperature; @Column @NotNull BigDecimal averageTemperature;
@Column @NotNull private final Sensor temperatureSensor; @Column @NotNull @OneToOne private final Sensor temperatureSensor;
@Column @NotNull private ThermostatState state; @Column @NotNull private ThermostatState state;