In a Model (MVC) query a View (SQL) or consult several tables

0

Good morning. I'm adapting my project to MVC and I have a question, in a form I need to recover the data from 3 tables. I have an already created (SQL) view where I can create the getRegistration () method of the 'Dao Member (Data Access Object)' model but I can not create the methods insertRegistration () or deleteRegistration () because I can not modify a view (SQL).

Then would it be more correct to create the 3 models for each table or would there be another solution?

PersonaDao --- > Person Table. Address Dao --- > Address table. HistorialDao --- > History table.

In the controller I would have to call the 3 models and I would have to make 3 queries, with the view (SQL) way only 1 but I could not modify it.

I hope I have been as clear as possible, if there is any doubt in the explanation, tell me

    
asked by Arkhan6 20.10.2016 в 13:12
source

1 answer

2

Simple you can create a BO (business object) or better yet a TO (transfer object), depending on the pattern you choose your DAO will build a BO with the 3 models or a TO with the most relevant data of the 3 models:

Form - > View, TO, BO, Pojos - > Model, DAO - > Controller

    
answered by 21.10.2016 в 04:36