Java对象存储在Mysql数据表的某一个属性列中,如何操作呢?
写入操作
<span style="white-space:pre"> </span>Object x=new Object();
<span style="white-space:pre"> </span>ByteArrayOutputStream baos=new ByteArrayOutputStream();
ObjectOutputStream out=new ObjectOutputStream(baos);
out.writeObject(x);
out.flush();
byte[] b=baos.toByteArray();
pre.setBytes(2, b);