DAO / VO Custom?

0

Good evening, I'm doing a project with connection to MySQL, I'm using the design patterns: MVC, DAO / VO.

I have several tables in my database, 11 in total, so I have 11 VO and 11 DAO, with which I make my queries and keep the information of them, now, in one of the views I need to show some information that joins two tables, I need some fields from table X and other fields from table Y, the way I solved this was creating a custom DAO / VO, where in the VO it mapped the data I needed to show from both tables, and in the DAO he carried out the respective consultations.

My specific question is: Is it correct to create a custom DAO which does not represent a table of the Database as such, but represents the union of several tables according to my need. Or am I violating some principle?

    
asked by Julian David 26.01.2018 в 03:49
source

1 answer

1

The DAO design pattern is about abstracting access to data from the rest of the application. No matter the data repository or the number of tables.

In Java EE is part of the patterns considered essential and detailed in the following url: link

For the business logic of your application, the important thing is not the tables, but the business objects that model the problem you are solving.

A single business object can result in the storage of data in multiple tables.

    
answered by 26.01.2018 / 14:42
source