我有多个 @Document
具有引用其他类的私有字段的类。我想知道是否应该为字段创建目标类或字符串的类型,并将目标类的id放在那里
@Id
private String id;
@NotBlank(message = "you should have a name ")
private String name;
@NotBlank(message = "each user has to have a username ")
private String username;
private List<String> groupChats = new ArrayList<>();
private List<String> friends = new ArrayList<>();
@NotBlank(message = "password should not be blank")
@Size(min = 4,max = 10, message = "please use 4 to 10 characters")
private String password;
private List<Role> roles=new ArrayList<>();
private Map<String,String> privateChats=new HashMap<>();```
例如, chatUser
类引用了一堆 privateChat
我正在保存那些私人的身份证 Chat
而不是 PrivateChat
输入Map。哪种方法更好更优化?
暂无答案!
目前还没有任何答案,快来回答吧!