Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
long memberNo = member.getMemberNumber();
if(memberNo < 1)
return;
try {
con = getConnection();
ps = con.prepareStatement("delete from members where member_no = ?");
ps.setLong(1, memberNo);
ps.executeUpdate();
ps.close();
ps = con.prepareStatement("insert into members " +
"(member_no, object_data) values (?, ?)");
ps.setLong(1, memberNo);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(member);
ps.setBytes(2, baos.toByteArray());
ps.executeUpdate();
} catch (IOException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
} finally {
if(ps != null)
try { ps.close(); } catch (SQLException e) {}
if(con != null)
try { con.close(); } catch (SQLException e) {}
}