title: how to use select (jdbc) with prepared statement using javafx
body: <p>I have a jdbc code and I want to select my data from database using prepared statement and javaFX . I mean i want to use java fx to get the String part . here is my data access code ,But I dont know how to write the controller method with Parameters and how to iterate the list.</p>
  
  <pre><code>      public ArrayList selectByNameAndFamily(Person person) throws Exception {
      preparedStatement = connection.prepareStatement("select * from person where name = ? and family = ?");
      preparedStatement.setString(1,person.getName());
      preparedStatement.setString(2,person.getFamily());
      ResultSet resultSet = preparedStatement.executeQuery();
      ArrayList&lt;Person&gt; list = new ArrayList&lt;&gt;();
      while (resultSet.next()) {
          person.setPhone(resultSet.getLong("phone"));
          person.setId(resultSet.getLong("id"));
          person.setPlaque(resultSet.getLong("plaque"));
          person.setUnit(resultSet.getLong("unit"));
          person.setName(resultSet.getString("name"));
          person.setFamily(resultSet.getString("family"));
          person.setAddress1(resultSet.getString("Address1"));
          person.setAddress2(resultSet.getString("address2"));
          person.setAddress3(resultSet.getString("address3"));
  
          list.add(person);
      }
      return list;
  </code></pre>
  
  <p>*note my table object name is Person and I already made object of PreparedStatement in my code .</p>