Hello,
One of my persistent objects use java.io.File, which has no 0-arg ctor.
Is there a way to just serialize the object into a blob column in SQL Server, or should I use the following method?
public MyClass {
private transient File file;
private String fileName;
private String getFileName() {
return fileName;
}
private void setFileName(String fileName) {
this.fileName = fileName;
file = new File(fileName);
}
public void setFile(File file) {
this.file = file;
}
public File getFile() {
if (file == null) {
file = new File(fileName);
}
return file;
}
}
Where i just persist the state of the File object as a String, and create the object as needed?
|