public void addOneComment(DocComment docComment) throws DocCommentManagerException { // TODO Auto-generated method stub PreparedDBUtil preparedDB = new PreparedDBUtil(); DBUtil dbUitl = new DBUtil(); String sql = "insert into td_cms_doc_comment(comment_id, doc_id,doc_comment,user_name,comtime,user_ip,src_comment_id,status) values(?, ?,?,?,?,?,?,?)"; try { int id = (Integer) dbUitl.executeSelectForObject(executor.getSql("getCommentNextId"), Integer.class); preparedDB.preparedInsert(sql); preparedDB.setInt(1, id); preparedDB.setInt(2, docComment.getDocId()); preparedDB.setClob(3, docComment.getDocComment(), "doc_comment"); preparedDB.setString(4, docComment.getUserName()); preparedDB.setTimestamp(5, new Timestamp(new Date().getTime())); preparedDB.setString(6, docComment.getUserIP()); if (docComment.getSrcCommentId() == 0) preparedDB.setNull(7, Types.NUMERIC); else preparedDB.setInt(7, docComment.getSrcCommentId()); preparedDB.setInt(8, docComment.getStatus()); preparedDB.executePrepared(); } catch (SQLException e) { e.printStackTrace(); throw new DocCommentManagerException("新评论插入失败!" + e.getMessage()); } finally { preparedDB.resetPrepare(); } }