@Override
    public int batchInsertNewsItem(List<NewsItem> newsItems) throws ServiceException {
        Connection conn = null;
        PreparedStatement pstmt = null;
        int[] rs = {};

        try {
            conn = DBUtils.getConn();
            pstmt = conn.prepareStatement(INSERT_NEWS_ITEM_SQL);
            for (NewsItem item : newsItems) {
                if (item.isInvalid()) {
                    continue;
                }
                pstmt.setString(1, item.getTitle());
                pstmt.setString(2, item.getContent());
                pstmt.setString(3, item.getSource());
                pstmt.setTimestamp(4, new Timestamp(item.getCreateTime().getTime()));
                pstmt.setLong(5, item.getHits());
                pstmt.setInt(6, item.getCategoryId());
                pstmt.addBatch();
            }
            rs = pstmt.executeBatch();
        } catch (SQLException e) {
            throw new ServiceException("sql exception.", e);
        } catch (ClassNotFoundException e) {
            throw new ServiceException("class not found exception.", e);
        } finally {
            try {
                DBUtils.close(conn, pstmt, null);
            } catch (SQLException e) {
                throw new ServiceException("close error.", e);
            }
        }

        return rs.length;
    }