Sunday, 15 July 2012

How to store an object which has File object in it in MongoDB using spring-data and java -


Hello, I'm called the Outbox shown below:

  @document (collection = "outbox") public class Outbox {Private string filename; Private string id; Private string user name; 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 Zero Set filename (string filename) {this.fileName = fileName; } Public string getId () {return ID; } Public Zero Set ID (string id) {this.id = id; } Public string getUserName () {return userName; } Public Zero SetUser Name (String Username) {this.userName = userName; } Public file getFile () {return file; } Public Zero Setfile (file file) {this.file = file; }}  

I have the file inside the outbox class. I know that a file can be stored in Mongo DB using GRDFS. But how to store an object in which there is a file .. Please help.


No comments:

Post a Comment