FIX: Create-drop databse. Add ManyToMany annotation
This commit is contained in:
@@ -13,6 +13,8 @@ import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.util.*;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Entity
|
||||
@@ -21,7 +23,9 @@ import javax.validation.constraints.NotNull;
|
||||
public class User {
|
||||
|
||||
@Id
|
||||
@NotNull
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
// @Column(name = "id")
|
||||
private Long id;
|
||||
|
||||
@NotNull
|
||||
@@ -36,6 +40,10 @@ public class User {
|
||||
@ElementCollection
|
||||
private Map<String,String> footPrintInputs = new HashMap<>();
|
||||
|
||||
@ManyToMany
|
||||
@JoinColumn
|
||||
private Collection<User> friends;
|
||||
|
||||
public User() {}
|
||||
|
||||
/**
|
||||
@@ -103,6 +111,10 @@ public class User {
|
||||
this.footPrintInputs = footPrintInputs;
|
||||
}
|
||||
|
||||
public ArrayList<User> getFriends(){
|
||||
return (ArrayList<User>)this.friends;
|
||||
}
|
||||
|
||||
public void setFootPrint(Float footPrint) {
|
||||
this.footPrint = footPrint;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user