ebean unidirectional @OneToOne relation with unique constraint
I have a User class: @Entity public class User extends Model { @Id public Long id; public String email; public String name; public String password; } and a driver class @Entity public class Driver extends Model { @Id public Long id; @OneToOne (cascade = CascadeType.ALL) @Column(unique = true) public User user; } I want to make sure that the user_id is unique inside the Drivers table. But the code above does not enforce that. (I can create multiple drivers with the same user id). Ideally, I do not want to add the @OneToOne relations in the User class because there are several different roles