<分区>
我想同时使用 hibernate
创建我的文件(只是 .txt 文件)并将其插入到 MySQL
数据库中,我卡在了这一部分插入它:
这是创建文件的部分:
BufferedWriter out = null;
try
{
FileWriter fstream = new FileWriter("out"+new Date().getHours()+""+new Date().getMinutes()+""+new Date().getSeconds()+".txt", true);
out = new BufferedWriter(fstream);
out.write("======== Date: "+new Date() +" ========");
out.write("\n==================================================");
out.write("\n===============Construction of file ==============");
out.write("\n==================================================");
//out.write( ...
//.... other lines
}
finally {
out.write("\n=================================================");
}
}
catch (IOException e)
{
System.out.println("ERROR");
}
finally {
if(out != null) {
out.close();
}
}
//.....
我的类(class):
public class A {
private Long AId;
private byte[] AFile;
//.. getters and setters
}