UserRole
是一个抽象类,它有三个具有三个不同角色的具体类。但是,每次我使用新角色创建新用户时,角色仍为null
!
以下是用户的代码:
@Entity
public class User extends Model {
@Id
public Long id;
@Constraints.Required
@Formats.NonEmpty
@Column(unique = true)
public String email;
@Constraints.Required
@Formats.NonEmpty
@Column(unique = true)
public String fullname;
public String confirmationToken;
@Constraints.Required
@Formats.NonEmpty
public String passwordHash;
@Formats.DateTime(pattern = "yyyy-MM-dd HH:mm:ss")
public Date dateCreation;
@Formats.NonEmpty
public Boolean validated = false;
**public UserRole role;**
}