title: java.sql.SQLException: The result set is closed
body: <p>When I try to execute my code I get error:</p>
  
  <blockquote>
    <p>ERROR [TripDAO] TripDAO: findAllTripsByActivityId()<br>
                  java.sql.SQLException: The result set is closed.</p>
  </blockquote>
  
  <p>Methods where I get error looks like:</p>
  
  <pre><code>public List&lt;Trip&gt; findAllTripsByActivityId(int id) {
      List&lt;Trip&gt; trips = new ArrayList&lt;Trip&gt;();
  
      if (obtainConnection()) {
          try {
              PreparedStatement stm = null;
              ResultSet rs = null;
              stm = con.prepareStatement(findAllTripsByActivityIdQuery
                      .toString());
              logger.info("Wybrano id: " + id);
              stm.setInt(1, id);
              rs = stm.executeQuery();
              while (rs.next()) {
                  trips.add(setInObject(rs));
              }
          } catch (Exception e) {
              logger.error("TripDAO: findAllTripsByActivityId() " + e);
          } finally {
              closeConnection();
          }
      }
      return trips;
  }
  
  public Trip setInObject(ResultSet rs) throws SQLException {
      Trip trip = new Trip();
      int id = rs.getInt("id");
      trip.setId(id);
      ...
      return trip;
  }
  </code></pre>
  
  <p>I have no idea what it could be wrong in this code. Can you help me?</p>