I have this code:
public enum Make{
FORD, BMW, AUDI
}
@Entity
public class User{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String email;
...
@OneToMany(...)
private Set<Cars> favoriteMakes = new HashSet<>();
}
I would like to be able to update a user by sending json with a list of favorite makes. F.e.: New user:
{
"id" : 1,
"email" : "email@mail.com",
...
"favoriteMakes" : []
}
I want to achieve :
{
"id" : 1,
"email" : "email@mail.com",
...
"favoriteMakes" : ["FORD", "AUDI"]
}
The things I've tried:
"favoriteMakes" : ["FORD", "AUDI"],
"favoriteMakes" : ["0", "2"],
"favoriteMakes" : [0, 2],