Beispiel #1
0
  /**
   * @see com.yahoo.petermwenda83.persistence.guardian.SchoolParentsDAO#getParent(java.lang.String)
   */
  @Override
  public StudentParent getParent(String studentUuid) {
    StudentParent studentParent = null;
    ResultSet rset = null;

    try (Connection conn = dbutils.getConnection();
        PreparedStatement pstmt =
            conn.prepareStatement("SELECT * FROM studentParent" + " WHERE studentUuid =?;"); ) {
      pstmt.setString(1, studentUuid);
      rset = pstmt.executeQuery();
      while (rset.next()) {
        studentParent = beanProcessor.toBean(rset, StudentParent.class);
      }

    } catch (SQLException e) {
      logger.error("SQL Exception trying to get studentParent with studentuuid: " + studentUuid);
      logger.error(ExceptionUtils.getStackTrace(e));
      System.out.println(ExceptionUtils.getStackTrace(e));
    }
    return studentParent;
  }