Spring data and mongoDB - inheritance and @DBRef
问题 I have this two documents, User: @Document(collection = "User") public class User { // fields } and Contact: @Document(collection = "Contact") public class Contact extends User{ // fields } and then I have a document which referes either to User oder Contact: @Document(collection = "DocumentFile") public class DocumentFile { @DBRef private User user; } So I am able to add User oder Contact in DocumentFile#user but if I set a Contact to DocumentFile#user than I lost the reference because in