It is not mandatory to use a layer only for database interaction. It goes a lot of the project you are developing.
For example, if you’re building a simple application, an To-Do List or a project with very few tables or entities, and you or someone for sure do not need to include new features in the future, do not see that it is necessary to waste time with the data layer.
On the other hand, if your project has the potential to grow (include new features, frequent changes, among others) I recommend looking with care, right at the beginning of the project, in a layer of repositories for your application, precisely to isolate the logic of the bank implementation business. This will make it much easier to evolve your application.
For a short project, it is best that I create a method for each operation, for each table?
– Felipe
@Felipe The example I have already set for you 4 methods per entity, saving you from having to implement selection, inclusion, updating and deletion for each entity of your project.
– Leonel Sanches da Silva