updated onetomany relationship
This commit is contained in:
parent
3921fe1330
commit
6e36d7d306
1 changed files with 6 additions and 7 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue