Hello! I have a conceptual question. I have a readDao (table) method inside the ObjectDAO (Bank Access) method that returns a HashSet named ResultRead with all objects in the database of that table . I also have an insertRule (Object obj) method inside an ObjectRule (business rule), which executes an ObjectDAO method, after doing the following verification:
if (!resultadoRead.contains(obj)) {
// executa a inserção do objeto no banco de dados.
ObjectDAO.insertDAO(obj);
}
My question is: For the contains function, do I need to implement the hashset and equals in the Object or in the DAO Class? because in the DAO class, there are no attributes, only methods. The attributes belong to the Object.
Do I use inheritance? another form of verification? I abandon java because this doubt is very stupid?