I have a method whose return type is customer which is a pojo. When I get required customerId
from database I want to return the customer object with the corresponding data of that customerId
. This means it has customer name, address etc. How to proceed for this?
public class Customer verifyCustomerId(cutomerId){
statement = connection.createStatement();
resultSet = statement.executeQuery("select customerid from customer");
while (resultSet.next()) {
if (cutomerId == resultSet.getInt(1)) {
// return data corresponding to this id in the form of object of pojo customer
}
}
return null;
}