I'm trying to create a method that return all users from customer table in my database but this code:
try {
List<Customer> customer = jdbi.open().createQuery("SELECT * FROM customer")
.mapTo(Customer.class).list();
} catch (Exception e) {
System.out.println(e);
}
return error:
org.jdbi.v3.core.mapper.NoSuchMapperException: No mapper registered for type com.customer.Customer
i saw another post of this error and they say that this error happened because of the mapping between the class model and the database table, but my app is built in pure java and JDBI 3 I'm not using Spring so how map the result of this code for convert this result in a List of Customer?
I fix this creating this class
and where was
.mapTo(Customer.class).list();
i put.map(new CustomerMapper()).list();
referencing the map I created