How to get list's itself while RowMapping with Maven in java

41 Views Asked by At

I am getting an error because of the type required in emails. It requires List<java.lang.String> but I wanted to ask would .emails((List<String>) resultSet.getObject("emails")); work for that situation?

private final RowMapper<Company> sampleRowMapper = (resultSet, i) -> new Company()
          .name(resultSet.getString("name"))
          .country(resultSet.getString("country"))
          .phoneNumber(resultSet.getString("phoneNumber"))
          .emails(resultSet.getObject("emails"));

Also, the email part is like this.

public Company emails(List<String> e_mails) {
    this.e_mails = e_mails;
    return this;
  }

1

There are 1 best solutions below

0
On BEST ANSWER

I have solved it with

.emails(Collections.singletonList("e_mails"));