-3
In my model I am accessing Clientedo by the controller of my model Customer as seen in the example below. I would like to know if this practice is correct for the mvc model, since both classes (client and client controllers) are in English.
Example: verify Cpf
Class of controller
public boolean verificarCpfExistente(String cpf){
if(ClienteDAO.getInstance().verificarCpf(cpf)==true)
return true;
return false;
}
Classe Clientedao
public boolean verificarCpf(String cpf){
String sql= "select * from cliente where cpf like ?";
try {
Connection conectar= conexao.getInstance().abrir();
PreparedStatement comando= conectar.prepareCall(sql);
comando.setString(1,cpf);
ResultSet resultset=comando.executeQuery();
resultset.next();
if(resultset.getString("cpf").equals(cpf))
return true;
} catch (Exception e) {
return false;
}
return false;
}
Full project if necessary: github.com/vvieira22/programsell
That answer might help you: Understand the MVC concept the right way
– DNick