0
很抱歉,但我很新手的MongoDB和Spring數據和我有一個關於這兩類問題:MongoDB中引用
@Document(collection = "person")
public class Person {
/**
*
*/
private static final long serialVersionUID = 6268875544266598239L;
@Id
private String Id;
private String name;
//@DBRef(db = "mail")
ArrayList<Mail> mails = new ArrayList<Mail>();
,另一種是:
@Document(collection = "mail")
public class Mail {
/**
*
*/
private static final long serialVersionUID = 9149555841222037638L;
@Id
private String Id;
private String mail;
Person person;
威爾在這種情況下,我在引用時遇到問題?我的意思是我需要將@DBref
或@Reference
或任何其他註釋與中的@ManyToOne
註釋一起使用嗎?我看到很多例子,但我不明白這一點是否沒有任何註釋工作?