{
final String sql = "SELECT * FROM addressbook.email WHERE addressbook.email.personID=" + userID;
Connection connection = getDataSource().getConnection();
PreparedStatement pstmt = connection.prepareStatement(sql);
ResultSet rs;
Email email;
if (pstmt.execute())
{
rs = pstmt.getResultSet();
emails = new ArrayList<>();
while (rs.next())
{
email = new Email();
email.setId(rs.getLong("emailID"));
email.setEmail(rs.getString("email"));
emails.add(email);
}
}
}