class にある次のコードがありますcustomerModel
。という別のクラスからこのメソッドを呼び出すにはどうすればよいcustomerController
ですか?
public ArrayList<Customer> search(Customer cust) {
ArrayList<Customer> custs = new ArrayList<Customer>();
Connection connection = GaritsConnectivity.connect();
Tuple<ResultSet, Statement> trs = GaritsConnectivity.read("SELECT * FROM Customer WHERE CustomerID=1", connection);
ResultSet rs = trs.getFirst();
try {
//takes a customer, returns it with the correct ID set
while (rs.next()) {
custs.add(createFromRs(rs));
}
} catch (SQLException ex) {
GaritsConnectivity.manageException("Customer search failure", ex);
}
GaritsConnectivity.doneReading(connection, trs);
return custs;
}
クラス内で、customerController
から検索メソッドを呼び出せる別のメソッドを作成したいと思いますCustomerModel
。
public class customerController....
public boolean search(){
//what goes in here im lost? how can i connect the above search from customerModel to customerController?
}