コード例 #1
0
  @Override
  public OrtDTO findPointByAxis(int punktX, int punktY) throws SQLException {
    OrtDTO ort = new OrtDTO();
    PreparedStatement preparedStatement = null;
    ResultSet resultSet = null;

    Connection connection = daoFactory.getConnection();
    preparedStatement =
        DaoUtil.prepareStatement(connection, FINDPOINTBYAXIS, false, new Object[] {punktX, punktY});
    resultSet = preparedStatement.executeQuery();

    while (resultSet.next()) {
      ort.setPointId(resultSet.getLong("id"));
      ort.setPointX(resultSet.getInt("xAxis"));
      ort.setPointY(resultSet.getInt("yAxis"));
      ort.setDescription(resultSet.getString("name"));
    }
    return ort;
  }
コード例 #2
0
  @Override
  public List<OrtDTO> findAllPoints() throws SQLException {
    List<OrtDTO> retVal = new ArrayList<OrtDTO>();
    PreparedStatement preparedStatement = null;
    ResultSet resultSet = null;

    Connection connection = daoFactory.getConnection();
    preparedStatement = DaoUtil.prepareStatement(connection, FINDALLPOINTS, false, new Object[0]);
    resultSet = preparedStatement.executeQuery();

    while (resultSet.next()) {
      OrtDTO ort = new OrtDTO();
      ort.setPointId(resultSet.getLong("id"));
      ort.setPointX(resultSet.getInt("xAxis"));
      ort.setPointY(resultSet.getInt("yAxis"));
      ort.setDescription(resultSet.getString("name"));
      retVal.add(ort);
    }
    return retVal;
  }