示例#1
0
  @Override
  public List<LmsFeedLikeVO> getLmsFeedLikeList() throws LmsDaoException {

    List<LmsFeedLikeVO> distList = new ArrayList<LmsFeedLikeVO>();

    // 1 . jdbc code start
    Connection conn = null;
    PreparedStatement stmt = null;
    try {
      conn = getConnection();

      String sql = "SELECT * FROM lms_feed_like ";
      stmt = conn.prepareStatement(sql);
      ResultSet rs = stmt.executeQuery();
      while (rs.next()) {

        // 3. Set db data to object
        LmsFeedLikeVO lmsFeedLikeVO = new LmsFeedLikeVO();

        lmsFeedLikeVO.setFeedLikeID(rs.getInt("FEED_LIKE_ID"));
        lmsFeedLikeVO.setFeedID(rs.getInt("FEED_ID"));
        lmsFeedLikeVO.setParentCommentID(rs.getInt("PARENT_COMMENT_ID"));
        lmsFeedLikeVO.setLikeOn(rs.getString("LIKE_ON"));
        lmsFeedLikeVO.setAssociateID(rs.getInt("ASSOCIATE_ID"));
        lmsFeedLikeVO.setLikeBy(rs.getString("LIKE_BY"));
        lmsFeedLikeVO.setLastUserIDCd(rs.getString("LAST_USERID_CD"));
        lmsFeedLikeVO.setLastUpdtTm(rs.getString("LAST_UPDT_TM"));

        // Add into list
        distList.add(lmsFeedLikeVO);
      }

      logger.debug("get records into the list...");

    } catch (SQLException se) {
      logger.error("lms_feed_like # " + se);
      throw new LmsDaoException(se.getMessage());
    } catch (Exception e) {
      logger.error("lms_feed_like # " + e);
      throw new LmsDaoException(e.getMessage());
    } finally {
      closeResources(conn, stmt, null);
    }
    // 1 . jdbc code endd

    // 4 Return as required by method
    return distList;
  }
示例#2
0
  @Override
  public LmsFeedLikeVO getLmsFeedLike(int id) throws LmsDaoException {

    System.out.println("Inside getLmsFeedLikeVO(?) >>");
    // Create object to return
    LmsFeedLikeVO lmsFeedLikeVO = new LmsFeedLikeVO();

    // 1 . jdbc code start
    Connection conn = null;
    PreparedStatement stmt = null;
    try {
      conn = getConnection();

      String sql = "SELECT * FROM lms_feed_like where FEED_LIKE_ID=?";
      stmt = conn.prepareStatement(sql);
      stmt.setInt(1, lmsFeedLikeVO.getFeedLikeID());
      ResultSet rs = stmt.executeQuery();
      if (rs.next()) {
        // 3. Set db data to object
        lmsFeedLikeVO.setFeedLikeID(rs.getInt("FEED_LIKE_ID"));
        lmsFeedLikeVO.setFeedID(rs.getInt("FEED_ID"));
        lmsFeedLikeVO.setParentCommentID(rs.getInt("PARENT_COMMENT_ID"));
        lmsFeedLikeVO.setLikeOn(rs.getString("LIKE_ON"));
        lmsFeedLikeVO.setAssociateID(rs.getInt("ASSOCIATE_ID"));
        lmsFeedLikeVO.setLikeBy(rs.getString("LIKE_BY"));
        lmsFeedLikeVO.setLastUserIDCd(rs.getString("LAST_USERID_CD"));
        lmsFeedLikeVO.setLastUpdtTm(rs.getString("LAST_UPDT_TM"));
      }

      logger.debug("get records into the table...");

    } catch (SQLException se) {
      logger.error("lmsFeedLikeVO # " + se);
      throw new LmsDaoException(se.getMessage());
    } catch (Exception e) {
      logger.error("lmsFeedLikeVO # " + e);
      throw new LmsDaoException(e.getMessage());
    } finally {
      closeResources(conn, stmt, null);
    }
    // 1 . jdbc code endd

    // 4 Return as required by method
    return lmsFeedLikeVO;
  }