您好我有一个名为Outbox的课程,如下所示:
@Document(collection="outbox")
public class OutBox {
private String fileName;
private String id;
private String userName;
private File file;
public OutBox(String fileName,String userName,File file){
this.fileName = fileName;
this.userName = userName;
this.file = file;
}
public OutBox(String id,String fileName){
this.id = id;
this.fileName = fileName;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public File getFile() {
return file;
}
public void setFile(File file) {
this.file = file;
}
}
我的outbox类里面有File。我知道可以使用GRIDFS将文件存储在mongoDB中。但是如何存储其中包含File的对象..请帮助。