title: Rows retrieved from Postgres using JDBC are all the same
body: <p>Below is a function that loads rows into an array of Records.</p>
  
  <pre><code>private static List&lt;Record&gt; LoadFromDb(String query, Connection connection, long take, long skip, Date minDate)
  {
      PreparedStatement preparedStatement = null;
      ResultSet resultSet = null;
      Logger logger = null;
      Record record = new Record();
      ArrayList&lt;Record&gt; records = new ArrayList&lt;Record&gt;();
  
      try
      {
          preparedStatement = connection.prepareStatement(query);
          preparedStatement.setDate(1, new java.sql.Date(minDate.getTime()));
          preparedStatement.setLong(2, take);
          preparedStatement.setLong(3, skip);
          resultSet = preparedStatement.executeQuery();
  
          while (resultSet.next())
          {
              record.by = resultSet.getString(1);
              record.category = resultSet.getString(2);
              record.channel = resultSet.getString(3);
              record.event_id = resultSet.getLong(4);
              record.message = resultSet.getString(5);
              record.package_type = resultSet.getString(6);
              record.sensor_type = resultSet.getString(7);
              record.serial_num = resultSet.getString(8);
              record.stamp = resultSet.getTimestamp(9);
              record.target = resultSet.getString(10);
              record.tbname = resultSet.getString(11);
              record.timezone = resultSet.getString(12);
              record.uuid = UUID.fromString(resultSet.getString(13));
              records.add(record);
          }
      }
      catch (Exception ex)
      {
          logger = Logger.getLogger(DbLoadSave.class.getName());
          logger.log(Level.SEVERE, ex.getMessage(), ex);
      }
      finally
      {
          try
          {
              if (resultSet != null)
              {
                  resultSet.close();
              }
              if (preparedStatement != null)
              {
                  preparedStatement.close();
              }
          }
          catch (SQLException ex)
          {
              logger = Logger.getLogger(DbLoadSave.class.getName());
              logger.log(Level.WARNING, ex.getMessage(), ex);
          }
      }
  
      return records;
  }
  </code></pre>
  
  <p>The Record class is as follows</p>
  
  <pre><code>import java.sql.Timestamp;
  import java.util.UUID;
  
  final class Record
  {
      public String by;
      public String category;
      public String channel;
      public long event_id;
      public String message;
      public String package_type;
      public String sensor_type;
      public String serial_num;
      public Timestamp stamp;
      public String target;
      public String tbname;
      public String timezone;
      public UUID uuid;
  
      public Record()
      {
          by = "";
          category = "";
          channel = "";
          event_id = 0;
          message = "";
          package_type = "";
          sensor_type = "";
          serial_num = "";
          stamp = null;
          target = "";
          tbname = "";
          timezone = "";
          uuid = null;
      }
  }
  </code></pre>
  
  <p>The query that is passed into LoadFromDb() is</p>
  
  <pre><code>SELECT by, category, channel, event_id, message, package_type, sensor_type, serial, stamp, target, tbname, timezone, uuid FROM all_events WHERE stamp &gt; ? LIMIT ? OFFSET ?;
  </code></pre>
  
  <p>When LoadFromDb() finishes executing, every object in the 'records' array is exactly the same. Why is this? Any help you can provide would be very much appreciated.</p>