updated onetomany relationship

This commit is contained in:
Tommaso Rodolfo Masera 2020-04-17 15:24:06 +02:00 committed by Claudio Maggioni (maggicl)
parent 3921fe1330
commit 6e36d7d306

View file

@ -1,10 +1,7 @@
package ch.usi.inf.sa4.sanmarinoes.smarthut.models; package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
import java.util.Set; import java.util.Set;
import javax.persistence.Column; import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
/** Represents a recursive invitation relationship between two users. */ /** Represents a recursive invitation relationship between two users. */
@ -12,11 +9,13 @@ import javax.validation.constraints.NotNull;
public class Invited { public class Invited {
/** A host user who can invite guests to their smart house */ /** A host user who can invite guests to their smart house */
@OneToMany private Set<User> host; @OneToMany(mappedBy = "host")
private Set<User> host;
/** Guests that have been invited to the host's house */ /** Guests that have been invited to the host's house */
@OneToMany(mappedBy = "host", orphanRemoval = true) @ManyToOne
private Set<User> guest; @JoinColumn(name = "guests")
private User guest;
/** Host ID */ /** Host ID */
@Id @Id